These extensions are added to the class System.Net.Mail.MailMessage and only availible for .net 4.5 and .net 4. They were introduced in version 1.2.

These methods are intended to load an xml document into the MailMessage and then go through the MailMessage and replace string keys with an actual value.

Loading a template Methods

Replacing the String keys Methods

Format of the MessageTemplate

<MailMessage>
    <To>user@test.com</To>
    <From>sender@test.com</From>
    <Subject>This is my test subject to ${name}</Subject>
    <Body><![CDATA[
    ]]></Body>
    <Bcc></Bcc>
    <CC></CC>
    <IsBodyHtml>false</IsBodyHtml>
    <Priority>None</Priority>
</MailMessage>
  • None of the Elements are required.
  • Priority must be a valid once a value from MailPriority Enum.
  • The CDATA for Body is not required.
  • The following tags can accrue more then one: To, Bcc, CC
  • IsBodyHtml must be true or false

Last edited May 15, 2013 at 6:17 PM by sannelsoftware, version 4

Comments

No comments yet.