原創(chuàng)|其它|編輯:郝浩|2012-11-27 09:54:57.000|閱讀 2623 次
概述:Aspose.Words可以將任何文檔保存為MHTML(Web Archive)格式。這意味著如果同時(shí)使用Aspose.Words和Aspose.Network,生成和發(fā)送含有豐富內(nèi)容的郵件將會(huì)變得很容易。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門(mén)軟控件火熱銷售中 >>
Aspose.Words可以將任何文檔保存為MHTML(Web Archive)格式。這意味著如果同時(shí)使用Aspose.Words和Aspose.Network,生成和發(fā)送含有豐富內(nèi)容的郵件將會(huì)變得很容易。例如,可以將一個(gè)預(yù)先定義的 DOC,OOXML或RTF文檔載入到Aspose.Words中,填入數(shù)據(jù),保存為MHTML,然后使用Aspose.Network發(fā)送郵件。
C#
// Load the document into Aspose.Words. string srcFileName = Path.Combine(dataDir, "DinnerInvitationDemo.doc"); Document doc = new Document(srcFileName); // Save into a memory stream in MHTML format. Stream stream = new MemoryStream(); doc.Save(stream, SaveFormat.Mhtml); // Rewind the stream to the beginning so Aspose.Network can read it. stream.Position = 0; // Create an Aspose.Network MIME email message from the stream. MailMessage message = MailMessage.Load(stream, MessageFormat.Mht); message.From = "your_from@email.com"; message.To = "your_to@email.com"; message.Subject = "Aspose.Words + Aspose.Network MHTML Test Message"; // Send the message using Aspose.Network SmtpClient client = new SmtpClient(); client.Host = "your_smtp.com"; client.AuthenticationMethod = SmtpAuthentication.None; client.Send(message);
VB
' Load the document into Aspose.Words. Dim srcFileName As String = Path.Combine(dataDir, "DinnerInvitationDemo.doc") Dim doc As New Document(srcFileName) ' Save into a memory stream in MHTML format. Dim stream As Stream = New MemoryStream() doc.Save(stream, SaveFormat.Mhtml) ' Rewind the stream to the beginning so Aspose.Network can read it. stream.Position = 0 ' Create an Aspose.Network MIME email message from the stream. Dim message As MailMessage = MailMessage.Load(stream, MessageFormat.Mht) message.From = "your_from@email.com" message.To = "your_to@email.com" message.Subject = "Aspose.Words + Aspose.Network MHTML Test Message" ' Send the message using Aspose.Network Dim client As New SmtpClient() client.Host = "your_smtp.com" client.AuthenticationMethod = SmtpAuthentication.None client.Send(message)
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自:慧都控件網(wǎng)