My application allows users to send emails. Before anyone thinks it's a spamming application, it's not. This email functionality allows transportation directors to notify students about delays with their school bus routes. Because of this, there are times when many emails get sent simultaneously.
Basically, the code is this:
Originally, email was configured to use my customers email server. When configured this way, the customer would occasionally get errors, such as:
[tt]Unable to send email. The server rejected one or more recipient addresses. The server response was: 501 5.1.3 Invalid address
or
The transport failed to connect to the server
[/tt]
According to the customer repeated attempts to send the email allows it to work.
I explained to the customer that the problem is probably caused by their email server and that there's nothing I can do to help resolve the problem. They insisted that the problem is mine and that I need to fix it.
I then suggested that they get a free gmail account and use that for their emails. They did this and all was well until today when they got an error regarding sending limits.
Finally, my question:
Using this method, is there a way to test connectivity to the mail server without actually sending an email?
-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
Basically, the code is this:
Code:
Set objCDOSysMail = CreateObject("CDO.Message")
Set objCDOSysCon = CreateObject("CDO.Configuration")
With objCDOSysCon
.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = oEmail.Configuration.SMTPServer
.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")[/URL] = oEmail.Configuration.RequiresAuthentication
.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/enablessl")[/URL] = oEmail.Configuration.UseSSL
.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusername")[/URL] = oEmail.Configuration.Username
.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendpassword")[/URL] = oEmail.Configuration.Password
.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = oEmail.Configuration.Port
.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2
.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpusessl")[/URL] = oEmail.Configuration.UseSSL
.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")[/URL] = 10
.Fields.Update
End With
Set objCDOSysMail.Configuration = objCDOSysCon
With objCDOSysMail
.From = oEmail.Configuration.From
.To = Addresses(i)
.Subject = oEmail.Subject
'.BCC = Cc
.HTMLBody = oEmail.Text
.Fields.Update
.Send
End With
Set objCDOSysMail = Nothing
Set objCDOSysCon = Nothing
Originally, email was configured to use my customers email server. When configured this way, the customer would occasionally get errors, such as:
[tt]Unable to send email. The server rejected one or more recipient addresses. The server response was: 501 5.1.3 Invalid address
or
The transport failed to connect to the server
[/tt]
According to the customer repeated attempts to send the email allows it to work.
I explained to the customer that the problem is probably caused by their email server and that there's nothing I can do to help resolve the problem. They insisted that the problem is mine and that I need to fix it.
I then suggested that they get a free gmail account and use that for their emails. They did this and all was well until today when they got an error regarding sending limits.
Finally, my question:
Using this method, is there a way to test connectivity to the mail server without actually sending an email?
-George
Microsoft SQL Server MVP
My Blogs
SQLCop
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom