Hi
I am using ASPOSE.Words to convert word document to mhtml stream as in your given example
‘Convert a Word Document to MHTML and Email’
in Documentation.
Now there I want to use MailMessage object of System.Net to send mail. So for that I have done following coding
Aspose.Words.Document doc = new Aspose.Words.Document(Server.MapPath("~/Sample.doc"));
doc.MailMerge.Execute(new string[] { "Name" }, new object[] { "Hardik" });
System.IO.Stream stream = new System.IO.MemoryStream();
doc.Save(stream, Aspose.Words.SaveFormat.Mhtml);
Now for sending mail using System.Net.MailMessage Object done following coding
stream.Position = 0;
System.IO.StreamReader readStream = new System.IO.StreamReader(stream);
readStream.BaseStream.Position = 0;
string strMailContent = readStream.ReadToEnd();
MailMessage message = new MailMessage();
message.To.Add(new MailAddress(strToEmailId, strToEmailName));
message.Subject = strSubject;
message.IsBodyHtml = true;
message.Body = strMailContent;
smtpClient.Send(message);
Now the mail which I got doesn’t contain Html Format instead its some content as below
MIME-Version: 1.0 Content-Type: text/html; charset=“utf-8” Content-Transfer-Encoding: quoted-printable Content-Location: document.html =EF=BB=BF
Dear Hardik,
instead of
Dear Hardik,
Pleae help me What should I do to get correct mhtml format content