Free Support Forum -

How to Convert a MapiMessage/MailMessage into Mime Text /Mime Document

How to Convert a MapiMessage/MailMessage into Mime Text /Mime Document.
Please Share Code for the same.



For converting MailMessage to MIME, please follow the sample code given below:

string dataDir = RunExamples.GetDataDir_Email();
// Create a new instance of MailMessage class
MailMessage message = new MailMessage();

// Set subject of the message
message.Subject = "New message created by Aspose.Email for .NET";

// Set Html body
message.IsBodyHtml = true;
message.HtmlBody = "<b>This line is in bold.</b> <br/> <br/><font color=blue>This line is in blue color</font>";

// Set sender information
message.From = "";

// Add TO recipients

// Add CC recipients

// Save message in EML, MSG and MHTML formats
message.Save(dataDir + "CreateNewEmail_out.eml", Aspose.Email.SaveOptions.DefaultEml);

message.Save(dataDir + "CreateNewEmail_out.msg", Aspose.Email.SaveOptions.DefaultMsgUnicode);

message.Save(dataDir + "CreateNewEmail_out.mhtml", Aspose.Email.SaveOptions.DefaultMhtml); 

For more details, please follow the link given below: