We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com


Help me please, where can I find list of email send exceptions?
I looked into the api reference but cannot find them.

Thank you


Thanks for writing to Aspose.Email support team.

Aspose.Email provides SmtpException and SmtpFailedBulkSendException classes to handle the exception for message sending. You may also view SmtpStatusCode to get the list of exception codes. Please give a try to the following sample code which demonstrates the detection of different exceptions and respective status code.

// load the MSG file using Aspose.Email for .NET
MailMessage msg = new MailMessage("user1@gmail.com", "user2@gmail.com", “My subject”, “My body”);
SmtpClient client = new SmtpClient();
client.Host = “[smtp.gmail.com](http://smtp.gmail.com/)”;

//Specify your mail user name
client.Username = “user01”;

//Specify your mail password
client.Password = “password”;

//Specify your Port #
client.Port = 587;
client.EnableSsl = true;
client.SecurityMode = SmtpSslSecurityMode.Explicit;

// send the message

// catch exception
catch (SmtpException ex)
if (ex.StatusCode == SmtpStatusCode.MailboxUnavailable)

Please feel free to write us back to if you have any other queries in this regard.

Thank you! It’s clear now for SMTP. And what about the same question, but for Exchange?


I am afraid to inform that I could not find any specific list of exceptions similar to SMTP exceptions. You may use ExchangeException class to handle the exceptions. Please have look at [ExchangeException Class](http://www.aspose.com/docs/display/emailnet/ExchangeException+Class) and [ExchangeException Members](http://www.aspose.com/docs/display/emailnet/ExchangeException+Members) for further details. Following is the sample code to use this class.

// Create instance of ExchangeWebServiceClient class by giving credentials
const string domain = @"";
const string username = @“UserName”;
const string password = @“Password”;
NetworkCredential credential = new NetworkCredential(username, password, domain);
ExchangeWebServiceClient client = new ExchangeWebServiceClient(“https:[//exchange.domain.com/ews/Exchange.asmx](https://exchange.domain.com/ews/Exchange.asmx)”, credential);

// create instance of type MailMessage
MailMessage msg = new MailMessage();
msg.From = "user01@gmail.com";
msg.To = "user02@gmail.com ";
msg.Subject = “Sending message from exchange server 2”;
msg.Body = “Sending message from exchange server”;
// send the message
catch (ExchangeException ex)