aspNetEmail

ErrorEventArgs Class

ErrorEvent Args used for raised exceptions.

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

System.Object
   EventArgs
      ErrorEventArgs

public class ErrorEventArgs : EventArgs

Example

[C#]
            void SendEmail()
            {
            	EmailMessage msg = new EmailMessage( "mail.myCompany.com");
            	msg.FromAddress = "me@myCompany.com";
            	msg.To = "You@YourCompany.com";
            	msg.Subject = "test email";
            	msg.Body = "enter you body contents here...";
            
            	//logging for easier troubleshooting
            	msg.Logging = true;
            	msg.LogPath = "c:\\email.log";
            
            	//wire up the Error event
            	msg.Error += new aspNetEmail.ErrorEventHandler( OnError );
            
            	msg.Send(); 
            	
            }
            
            void OnError( object sender, aspNetEmail.ErrorEventArgs e )
            {
            	//write out the exception, but don't throw it
            	Console.Write( e.Exception );
            
            	e.ThrowException = false;
            }
            
            
            
[VB.NET]
            Sub SendEmail()
               Dim msg As New EmailMessage("mail.myCompany.com")
               msg.FromAddress = "me@myCompany.com"
               msg.To = "You@YourCompany.com"
               msg.Subject = "test email"
               msg.Body = "enter you body contents here..."
               
               'logging for easier troubleshooting
               msg.Logging = True
               msg.LogPath = "c:\email.log"
               
               'wire up the Error event
               AddHandler msg.Error, AddressOf OnError
               
               msg.Send()
            End Sub 'SendEmail
             
            
            Sub OnError(sender As Object, e As aspNetEmail.ErrorEventArgs)
               'write out the exception, but don't throw it
               Console.Write(e.Exception)
               
               e.ThrowException = False
            End Sub 'OnError
            
            

Requirements

Namespace: aspNetEmail

Assembly: aspNetEmail (in aspNetEmail.dll)

See Also

ErrorEventArgs Members | aspNetEmail Namespace