Hi,
When i click button, document will be Generated and saved in particular place....
After i want to send to mail only content to the body..
How to Send content of document to body of the mail.....?
Please tell me the solution..
Thank you
NARENDRAN
Hi Narendran,
You can use Aspose.Email in combination with Aspose.Words API to load MHTML file and send it using the API. Please have a look at the following code sample for your kind reference and let us know if you need further assistance in this regard.
You can also refer to our documentation for further reference in this regard.
Sample Code:
string dataDir = “sourcefolderPathtodocument\”;
// Load a Word document from disk and save to stream as MHTML
Document wordDocument = new Document(dataDir + “Test.doc”);
MemoryStream mhtmlStream = new MemoryStream();
wordDocument.Save(mhtmlStream, SaveFormat.Mhtml);
// Load the MHTML in MailMessage
mhtmlStream.Position = 0;
MailMessage message = MailMessage.Load(mhtmlStream, new MhtmlLoadOptions());
message.Subject = “Sending Invoice in Email”;
message.From = "sender@gmail.com";
message.To = "recipient@gmail.com";
// Save the message in MSG format to disk
message.Save(dataDir + “WordDocAsEmailBody_out.msg”, SaveOptions.DefaultMsgUnicode);
// Send in an email
SmtpClient client = new SmtpClient(“smtp.gmail.com”, 587, "sender@gmail.com", “pwd”);
client.SecurityOptions = SecurityOptions.SSLExplicit;
client.Send(message);
Thanks,
Hi Narendran,