CDO Question: transport failed to connect to the server

L

Lori McDonald

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 <[email protected]>"
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top