Resolving “Source: CDO.Message.1 Description: The transport failed to connect to the server” error while sending email using CDOSYS


While sending email using CDOSYS in SQL Server, you may receive an error as below:

(1 row(s) affected)
(1 row(s) affected)
  Source: CDO.Message.1
  Description: The transport failed to connect to the server.
(1 row(s) affected)

Resolution:

This message informs you that host server could not connect to SMTP server. Hence please take below steps to fix this issue:

  1. Find the SMTP server name used in the procedure. It will be in the below line with in the SP (assuming you are using Microsoft supplied procedure)

EXEC @hr = sp_OASetProperty @iMsg, 'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/smtpserver").Value', '[SMTP SERVER NAME]'  

Make sure that you can not use the supplied SMTP server name using below command in command prompt:

      telnet [SMTP SERVER NAME] 25

It should throw an error complaing SMTP connection could not be established.

[Note: Typically SMTP Server uses Port 25 for telnet hence we are trying to establish a connection with port 25 in this example. Replace 25 with correct value if your SMTP server is customized to use another value]

  1. Replace SMTP Server name with correct server/IP in the actual procedure and recompile it. This step should resolve the issue.

Comments

Laura Bush said…
Amazing article, Which you have shared about the SMTP Server. This article is very interesting and I liked to read it. If anyone looking to dedicated SMTP Server, then visit at mails2inbox.com