Performs a mail merge using an object that implements IEnumerable.
True if the mail merge was successful
[C#]
EmailMessage msg = new EmailMessage( );
msg.FromAddress = "me@myCompany.com";
msg.Subject = "Order Confirmation";
//logging for easier troubleshooting
msg.Logging = true;
msg.LogPath = "c:\\email.log";
//a Person class
Person p1 = new Person();
p1.FirstName = "Steve";
p1.EmailAddress = "steve@mycompany.com";
Person p2 = new Person();
p2.FirstName = "Tiffany";
p2.EmailAddress = "tiffany@mycompany.com";
//create a collection of Person objects
ArrayList people = new ArrayList();
people.Add( p1 );
people.Add( p2 );
//create and add more people
//...
//...
//perform a mail merge based upon the properties of the Person object
msg.To = "##EmailAddress##";
msg.Body = "Hi ##FirstName##\r\n Here is your invoice and order confirmation...";
//send the mail merge
msg.SendMailMergeToMSPickup( people );
[VB.NET]
Dim msg As New EmailMessage()
msg.FromAddress = "me@myCompany.com"
msg.Subject = "Order Confirmation"
'logging for easier troubleshooting
msg.Logging = True
msg.LogPath = "c:\email.log"
'a Person class
Dim p1 As New Person()
p1.FirstName = "Steve"
p1.EmailAddress = "steve@mycompany.com"
Dim p2 As New Person()
p2.FirstName = "Tiffany"
p2.EmailAddress = "tiffany@mycompany.com"
'create a collection of Person objects
Dim people As New ArrayList()
people.Add(p1)
people.Add(p2)
'create and add more people
'...
'...
'perform a mail merge based upon the properties of the Person object
msg.To = "##EmailAddress##"
msg.Body = "Hi ##FirstName##" + ControlChars.Cr + ControlChars.Lf + " Here is your invoice and order confirmation..."
'send the mail merge
msg.SendMailMergeToMSPickup(people )
EmailMessage Class | aspNetEmail Namespace | EmailMessage.SendMailMergeToMSPickup Overload List