Using Mailmessage to set mime type of an Email

How can we use mailMessage to get & set mimetype of an email ? I wish to set the mimetype or content type to text/plain or html as needed. Prior to that I wish to fetch the mime type of an email.

Hi Ankit,


Thank you for posting your inquiry.

For retrieval purpose, please get the value of message Content-Type header from message headers.

Code:

MailMessage message = MailMessage.Load(“Msg with Voting buttons.eml”);
Console.WriteLine(message.Headers[“Content-Type”]);

In order to generate the message with text/plain or html, please follow our documentation articles as listed below. These show how to generate a message with plain text, html or both views.