Free Support Forum - aspose.com

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.

thanks

@ravikumarchopra

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 = "from@domain.com";

// Add TO recipients
message.To.Add("to1@domain.com");
message.To.Add("to2@domain.com");

// Add CC recipients
message.CC.Add("cc1@domain.com");
message.CC.Add("cc2@domain.com");

// 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:
https://docs.aspose.com/display/emailnet/Working+with+MIME+Messages