Hi sureshMGR,
First you need to convert the byte data to UTF8 encoding string. Then again convert UTF8 encoding string to byte array and attach the byte array to the MemoryStream as attachment.
Try with the below code.
byte[] byteData = attachment;
string utf8String = System.Text.Encoding.UTF8.GetString(byteData);
byte[] bytes = System.Text.Encoding.UTF8.GetBytes(utf8String);
mail.Subject = subject;
if (body != "No Data")
{
Attachment attach = new Attachment(new MemoryStream(bytes), attachmentName + ".xlsx");
mail.Attachments.Add(attach);
}
mail.IsBodyHtml = true;
_mailBody = body;
mail.Body = _mailBody;
SmtpClient smtp = new SmtpClient("xxx.net");
smtp.Send(mail);