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

Free Support Forum - aspose.com

Code misbehaving when SMTP server is down

We have problem today with our mail server. Their SMTP server went down. The only time in years we have had that problem. However it brought our server to it's knees. The majority of the errors that were recorded is like the one below. A sample of our code is below that.

I realize it was a provider failure, but is there a best practices type of approach to keep their failure from becoming ours, by sending to an alternative SMTP server, queuing for later or even dropping them without the server lag would be preferable.

Thanks
Randy Miller

Aspose.Email.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

and
var smtp = new Aspose.Email.Mail.SmtpClient("our smtp server", 1025, "our login", "our password");
try
{
    smtp.Send(mm);
}
catch (Exception ex)
{
    mySession.LogError("tg.objects.email.SendEmail 184");
    mySession.LogException(ex);
}

Hi Randy,

We are sorry to share that there is no other method available that can help in this regard. The SmtpClient of the API doesn’t have any such method to identify if the server is available or not. Please let us know if we could be of any additional help to you in this regard.

Is there an easy way to buffer the emails on my server and then have the buffer send it to SMTP server?


I don’t really consider it a problem with your software, but was just hoping that since you know a lot more about email sending than I do, you might know about a best practice that would help.

Thanks
Randy

Hi Randy,

We are afraid to share that no such method is available to determine if the SMTP server is available or not. However, you can use some methods available online such as sending an EHLO command to the SMTP server. This article may also be of help to you.