문서를 MHTML로 변환하고 이메일로 보내기
Contents
[
Hide
]
Aspose.Words는 모든 문서를 MHTML(웹 아카이브) 형식으로 변환할 수 있습니다. 따라서 Aspose.Words와 Aspose.Email
를 함께 사용하는 것이 편리합니다. DOC, OOXML, RTF 등 지원되는 형식의 미리 정의된 문서를 Aspose.Words에 로드하고 데이터로 채운 다음 결과 문서를 MHTML로 저장한 다음 Aspose.Email
를 사용하여 이메일로 보낼 수 있습니다.
다음 코드 예제에서는 문서를 MHTML로 변환하고 이메일로 보내는 방법을 보여줍니다
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET | |
Document doc = new Document(MyDir + "Document.docx"); | |
Stream stream = new MemoryStream(); | |
doc.Save(stream, SaveFormat.Mhtml); | |
// Rewind the stream to the beginning so Aspose.Email can read it. | |
stream.Position = 0; | |
// Create an Aspose.Email MIME email message from the stream. | |
MailMessage message = MailMessage.Load(stream, new MhtmlLoadOptions()); | |
message.From = "your_from@email.com"; | |
message.To = "your_to@email.com"; | |
message.Subject = "Aspose.Words + Aspose.Email MHTML Test Message"; | |
// Send the message using Aspose.Email. | |
SmtpClient client = new SmtpClient(); | |
client.Host = "your_smtp.com"; | |
client.Send(message); |