MailMessageEncodeAllHeaders Method |
Namespace: MailBee.Mime
Exception | Condition |
---|---|
MailBeeInvalidArgumentException | targetEncoding is a null reference (Nothing in Visual Basic). |
The developer should use this method before saving or sending an e-mail message if any message headers or attachment names contain international characters.
The developer can also encode custom header names using GetEncodedHeaderValue(String, String, Encoding, HeaderEncodingOptions) method.
// To use the code below, import the following namespaces at the top of your code. using System.Text; using MailBee; using MailBee.Mime; // The actual code (put it into a method of your class). MailMessage msg = new MailMessage(); msg.LoadMessage(@"C:\Docs\source.eml"); msg.EncodeAllHeaders(Encoding.UTF8, HeaderEncodingOptions.Base64); msg.SaveMessage(@"C:\Temp\result.eml");