aspNetEmail

ErrorEventArgs.ThrowException Property

If True, throws the exception.

public bool ThrowException {get; set;}

Remarks

By default, this value will inherit the value of the ThrowException property of the EmailMessage object

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
            
            

See Also

ErrorEventArgs Class | aspNetEmail Namespace