aspNetEmail

MergedRowSentEventArgs Class

Summary description for EventArgs.

For a list of all members of this type, see MergedRowSentEventArgs Members.

System.Object
   EventArgs
      MergedRowSentEventArgs

public class MergedRowSentEventArgs : EventArgs

Example

[C#]
            void SendEmail()
            {
            	EmailMessage msg = new EmailMessage( "mail.myCompany.com");
            	msg.FromAddress = "me@myCompany.com";
            	msg.To = "##Email_Address##";
            	msg.Subject = "Order Confirmation";
            	msg.Body = "Hi ##fldFirstName##\r\n Here is your invoice and order confirmation...";
            
            	//logging for easier troubleshooting
            	msg.Logging = true;
            	msg.LogPath = "c:\\email.log";
            
            
            	//get the datatable for the mail merge
            	DataTable dt = GetDataTable();
            
            	//wire up the MergedRowSent so we can track each message sent
            	msg.MergedRowSent += new MergedRowSentEventHandler( OnRowSent );
            
            	msg.SendMailMerge( dt );
            	
            }
            
            void OnRowSent( object sender, MergedRowSentEventArgs e )
            {
            	//if we wanted to cancel the mail merge we could call
            	//e.Cancel = true
            
            	//get the email address of the row that was just sent
            	string emailAddress =e.Row[ "Email_Address" ].ToString();
            	Console.WriteLine( emailAddress );
            
            	//check to see if the merge was successfully sent
            	Console.WriteLine( e.Success );
            }
            
            
            
            
[VB.NET]
            
            Sub SendEmail()
               Dim msg As New EmailMessage("mail.myCompany.com")
               msg.FromAddress = "me@myCompany.com"
               msg.To = "##Email_Address##"
               msg.Subject = "Order Confirmation"
               msg.Body = "Hi ##fldFirstName##" + ControlChars.Cr + ControlChars.Lf + " Here is your invoice and order confirmation..."
               
               'logging for easier troubleshooting
               msg.Logging = True
               msg.LogPath = "c:\email.log"
               
               
               'get the datatable for the mail merge
               Dim dt As DataTable = GetDataTable()
               
               'wire up the MergedRowSent so we can track each message sent
               AddHandler msg.MergedRowSent, AddressOf OnRowSent
               
               msg.SendMailMerge(dt)
            End Sub 'SendEmail
             
            
            Sub OnRowSent(sender As Object, e As MergedRowSentEventArgs)
               'if we wanted to cancel the mail merge we could call
               'e.Cancel = true
               'get the email address of the row that was just sent
               Dim emailAddress As String = e.Row("Email_Address").ToString()
               Console.WriteLine(emailAddress)
               
               'check to see if the merge was successfully sent
               Console.WriteLine(e.Success)
            End Sub 'OnRowSent
            
            

Requirements

Namespace: aspNetEmail

Assembly: aspNetEmail (in aspNetEmail.dll)

See Also

MergedRowSentEventArgs Members | aspNetEmail Namespace