Monday, August 18, 2008

Unable to send mail! The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available

Unable to send mail! The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available .
use following code to correct

objEmail.Body = EmailBody;
objEmail.Priority = MailPriority.High;
objEmail.BodyFormat = MailFormat.Html;
objEmail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"] = 2;
objEmail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserver"] = "mail.domain.net";

objEmail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = "newsletter@domain.net";
objEmail.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = "password";
objEmail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1;
System.Web.Mail.SmtpMail.SmtpServer = "servername or IP";

No comments: