Message could not be sent
14 February 2008 Tips  Marek Sienkiewicz
Bubble image

'The message could not be sent to the SMTP server.
The transport error code was 0x80040217.
The server response was not available.'


This means that username and password are incorrect.

 Mail.To = "YourName@DomainName.com"
 Mail.From = txtName.Text

 Mail.BodyFormat = MailFormat.Text
 Mail.Priority = MailPriority.Normal
 Mail.Subject = "Your Reference"

Mail.Body = "From: " + txtName.Text + vbNewLine +
"Email: " + txtEmail.Text + vbNewLine +
"Subject: " + txtSubject.Text + vbNewLine +
"Message: " + txtMessage.Text

Mail.Fields.Add
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
"1")

Mail.Fields.Add
("http://schemas.microsoft.com/cdo/configuration/sendusername", "YourName@DomainName.com")

Mail.Fields.Add(
"http://schemas.microsoft.com/cdo/configuration/sendpassword",
"Password")

 SmtpMail.SmtpServer = "mail.DomainName.com"
 SmtpMail.Send(Mail)

Note that System.Web.Mail is obsolete and
the alternative is System.Net.Mail






Please post your comments:

Name

Email
                           

   

Enter the text you see in the box:

Captcha Image