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,
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;
}
ok. please keep me updated
Hi Jimmy,
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.