Email body

i am using the aspose email for sending out the email. one issue is, i convert one sheet into html file, and then i use streamreader to get the content from the html file into memory stream. But the format is missing some. i tried reduced some columns, it was good. So what’s the problem?

FYI, i am currently using aspose email v1.0.0.0

Hi Jimmy,


Thank you for contacting Aspose support team.

It is observed that you are using quite old version of Aspose.Email. Currently Aspose.Email for .NET 4.2.0 is released and available for download. Could you please test same scenario using the latest release and let us know your feedback?

If the problem still persists, please send us the sample console application, original xls file which is causing problem and the modified one after reducing the columns. It will help us to re-produce the scenario here and provide assistance as soon as possible.

Sorry, I made a mistake. Actually I am using 4.0.0.0 for the email sending program. I have tried the latest version you provided, still doesn’t work. I can only give you the two file templates with below code since it’s pretty sensitive for our customer.

//Save sheet as memory string
static string GetFileString(string file)
{
new License().SetLicense(“Aspose.Total.lic”);
Workbook wb = new Workbook(file);

string FileString = string.Empty;
using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
{
wb.Save(ms, SaveFormat.Html);
ms.Position = 0;
System.IO.StreamReader sr = new System.IO.StreamReader(ms, System.Text.Encoding.Default);
FileString = sr.ReadToEnd();
}

return FileString;
}

//Send email method
private bool InnerSend(out string ErrorMsg)
{
bool ret = false;
ErrorMsg = string.Empty;
MailMessage Message = null;
IEWSClient ExchangeMailClient = null;
SmtpClient SmtpMailClient = null;
try
{
Message = new MailMessage(EmailInfoData.Sender, EmailInfoData.Recipients);
if (!string.IsNullOrEmpty(EmailInfoData.Cc))
Message.CC = EmailInfoData.Cc;
Message.IsBodyHtml = EmailInfoData.IsHTML;
Message.Body = EmailInfoData.MailBody;
Message.BodyEncoding = ASCIIEncoding.ASCII;
Message.Subject = EmailInfoData.MailSubject;
Message.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
foreach (string Attachement in EmailInfoData.AttachmentList)
Message.Attachments.Add(new Attachment(Attachement));

if (EmailInfoData.NeedRecall)
{
ExchangeMailClient = EWSClient.GetEWSClient(EmailInfoData.ExchangeWsURL, EmailInfoData.UserName, EmailInfoData.PassWord);
ExchangeMailClient.Send(Message);
ret = true;
}

else
{
SmtpMailClient = new SmtpClient(EmailInfoData.Host, EmailInfoData.Port, EmailInfoData.UserName, EmailInfoData.PassWord);
SmtpMailClient.Send(Message);
ret = true;
}

}

catch (Exception ex)
{
ret = false;
ErrorMsg = ex.ToString();
}

finally
{
if (Message != null)
Message.Dispose();
Message = null;
if (ExchangeMailClient != null)
ExchangeMailClient.Dispose();
ExchangeMailClient = null;
if (SmtpMailClient != null)
SmtpMailClient.Dispose();
SmtpMailClient = null;

}
return ret;
}

Hi Jimmy,

Thank you for sharing sample code and data.

I was able to reproduce this issue at my end using the latest version of Aspose.Email for .NET 4.2.0 and have logged it as NETWORKNET-34382 in our issue tracking system for further investigation by our development team. Once there is any information available in this regard, we'll update you here via this thread here.

We are sorry for the inconvenience caused to you.

ok. please keep me updated

Hi Jimmy,


Sure, you will be automatically notified once any update is received.

Hi Jimmy,

We have investigated this issue at our end and found that this is not a bug at Aspose.Email end. Here are our findings:

1. The Internet Explorer views this html correctly.
2. The MS Word views this html not properly.
3. It seems, Outlook uses the same html engine as the MS Word.

If you save the message as EML and open in Thunderbird or Outlook, you will notice that there is no issue with the message file.