Unable to send mail via SMTP

Discussion in 'Email' started by minideez, May 31, 2011.

  1. I'm unable to send mail; I receive 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"

    I used sample code from the KB, it is below:

    Dim strFrom = "postmaster@sfvictoriana.biz"
    Dim strTo = "postmaster@sfvictoriana.biz"
    Dim MailMsg As New MailMessage(New MailAddress(strFrom.Trim()), New MailAddress(strTo))
    MailMsg.BodyEncoding = Encoding.Default
    MailMsg.Subject = "This is a test"
    MailMsg.Body = "This is a sample message using SMTP authentication"
    MailMsg.Priority = MailPriority.High
    MailMsg.IsBodyHtml = True
    'Smtpclient to send the mail message

    Dim SmtpMail As New SmtpClient
    Dim basicAuthenticationInfo As New System.Net.NetworkCredential("postmaster@sfvictoriana.biz", "correct")

    SmtpMail.Host = "mail.sfvictoriana.biz"
    SmtpMail.UseDefaultCredentials = False
    SmtpMail.Credentials = basicAuthenticationInfo

    Catch ex As Exception
    End Try

    I am able to login via the username and password specified via the mail manager. If I use IIS manager to look at my domains smtp settings, there is no smtp server specified and auth settings are set to "Not Required". Could this be the issue?

  2. After you set the credentials, try adding:

    SmtpMail.Port = 587
  3. Success. Thank you Chuck. Can you provide any insight as to why I needed to do this, or should this step be added to the code sample?
  4. Your port is being blocked by your ISP or Anti-virus/firewall service. 587 is just an alternate port we offer for those who cant use 25.

Share This Page