MessageBuilderConfigApply Method |
Namespace: MailBee.Mime
The Builder properties which affect building the message should be set BEFORE using this method. Otherwise, these options won't take effect.
Normally, there is no need to call this method since MailBee automatically applies the current Builder settings when building the MIME source of the message from its properties and collections. You should, however, call this method if you need to get the results of buiding the message without saving it into a file, sending it, etc. For instance, if you configured MailBee to generate plain-text version of the HTML body during building the message (actually, this convesion is turned on by default), you may want to get this plain-text version for some reason (i.e. you are not going to send the message now, you need this plain-text version itself). In this case, it's enough to call Apply method.
Internally, Apply method just calls GetMessageRawData method of the parent MailMessage object but does not return any value.
// To use the code below, import MailBee namespaces at the top of your code. using MailBee; using MailBee.Mime; // The actual code (put it into a method of your class) // Load the message body from HTML file. MailMessage msg = new MailMessage(); msg.LoadBodyText(@"C:\Docs\index.htm", MessageBodyType.Html); // Show the empty plain-text message body. Console.WriteLine(msg.BodyPlainText); Console.WriteLine("---------------------------------------"); // Build the message. Plain-text version will be created at this moment. msg.Builder.Apply(); // Show the generated plain-text message body. Console.WriteLine(msg.BodyPlainText);