CDO Question: transport failed to connect to the server

Discussion in 'ASP .Net' started by Lori McDonald, Feb 16, 2004.

  1. I have code that I am using to sent an HTML email. (see code below)

    Intermittently I am getting the following error when I try and send an
    email message from ASP.Net code on my server. 80% of the time it works
    fine -- but 20% of the time it
    fails with the following message:
    The transport failed to connect to the server.

    I am setting the mail server via the IP address. It actually is the
    local mail server, but I didn't want to have any DNS resolution issues
    -- so I don't understand how it could ever not connect.

    It only seems to be happening for HTML formatted emails. I have
    similar code in .Net that sends text messages and it is working fine.

    I have enabled the website IP it is coming from for connection and
    relay within the SMTP properties in IIS.

    This sounds like a configuration issue, but I don't understand why it
    would be intermittent. It only seems to happen from my ASP.Net code. I
    have ASP mailers that are
    not seeing this problem.

    If you go back and try and resend the same email a minute or so later
    it will send.

    This has happened about 9 times (out of probably 50 emails) in the
    last 3 months. So it is a problem. I keep trying fixes but it is so
    intermittent I cannot tell if it is fixed for sure until we see the
    error occur again.

    When it occurs the page takes a long time (maybe 5 minutes) to reload
    -- like it is trying to contact the server and not getting through.

    Does anyone have any ideas what might be wrong or how I can
    troubleshoot this?

    Thanks,
    Lori

    ----------------------------------------------------------------------------

    Dim mailMessage As New System.Web.Mail.MailMessage()

    If From = "" Then 'Set default
    mailMessage.From = "Me <>"
    Else
    mailMessage.From = From
    End If

    mailMessage.To = ToAddresses

    mailMessage.Bcc = BCCs

    If Not _arListAttachments Is Nothing Then
    Dim myEnumerator As System.Collections.IEnumerator =
    _arListAttachments.GetEnumerator()
    While myEnumerator.MoveNext()
    mailMessage.Attachments.Add(New
    MailAttachment(myEnumerator.Current.ToString,
    System.Web.Mail.MailEncoding.Base64))
    End While
    End If

    If LCase(Priority) = "high" Then
    mailMessage.Priority = System.Web.Mail.MailPriority.High
    ElseIf LCase(Priority) = "low" Then
    mailMessage.Priority = System.Web.Mail.MailPriority.Low
    End If

    mailMessage.BodyFormat = System.Web.Mail.MailFormat.Html

    Dim strBody As String
    Dim strDBSubject As String

    'This routine gets the Body of the message using a template database
    driven system
    GetMessage(strBody, strDBSubject, intError)

    If intError = 0 Then
    mailMessage.Body = strBody

    If Subject <> "" Then 'Set default
    mailMessage.Subject = Subject
    ElseIf strDBSubject <> "" Then
    mailMessage.Subject = strDBSubject
    Else
    mailMessage.Subject = ""
    End If

    System.Web.Mail.SmtpMail.SmtpServer = _strMailServer

    System.Web.Mail.SmtpMail.Send(mailMessage)

    End If
    Lori McDonald, Feb 16, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. James Lankford
    Replies:
    14
    Views:
    21,069
    naveenkumarmandava
    Jul 16, 2008
  2. Sudhan
    Replies:
    1
    Views:
    7,724
    Teemu Keiski
    Dec 20, 2005
  3. =?Utf-8?B?bmJpc3NldHRl?=
    Replies:
    1
    Views:
    3,539
    jcallinan
    Oct 2, 2006
  4. Hawksey
    Replies:
    1
    Views:
    897
    rajanand_m
    Nov 6, 2009
  5. Nathan Sokalski
    Replies:
    5
    Views:
    589
    Ricky Yau
    Dec 11, 2006
Loading...

Share This Page