Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET SMTP

 AfterLogic Forum : MailBee.NET SMTP
Subject Topic: Get SMTP status code on send exception Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
shoey1
Newbie
Newbie
Avatar

Joined: 19 March 2014
Location: United Kingdom
Online Status: Offline
Posts: 5
Posted: 19 March 2014 at 8:32am | IP Logged Quote shoey1

If you use an .Net SMTP client you can use the following code to get the SMTP error code and the message if there was an exception with sending a message.

try
{
     aSmtpClient.Send(aMailMessage);
}
catch (SmtpException e)
{
     ErrorCode = ((int) e.StatusCode).ToString(), //eg 553
     ErrorDescription = e.Message, //Mailbox name not allowed. The server response was: Message rejected - see http://www.spamhaus.org/query/bl?ip=46.65.200.122
}

Is there something similar to this or would i have to test for each exception type as in here: http://www.afterlogic.com/mailbee-net/docs/handle_exceptions_and_errors.html#ErrorCodes


Back to Top View shoey1's Profile Search for other posts by shoey1
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 19 March 2014 at 9:05am | IP Logged Quote Alex

Catch MailBeeSmtpNegativeResponseException for that. Its .ResponseCode and .ResponseString contain the values you need.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
shoey1
Newbie
Newbie
Avatar

Joined: 19 March 2014
Location: United Kingdom
Online Status: Offline
Posts: 5
Posted: 19 March 2014 at 9:09am | IP Logged Quote shoey1

Thanks Alex
Back to Top View shoey1's Profile Search for other posts by shoey1
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide