Espen torgerse 2012-08-04 21:56:28
we’ve been using CDO to send mail from a custom ASPNET application, but
now it has suddenly (and unexpectedly) stopped working. The error message
returned is (the infamous) “CDO.Message.1 error ‘80040213’ The transport failed to
connect to the server”
The application uses localhost (listening on *all unassigned*) as
SMTP-relay, which in turn is configured to forward mail to a smarthost
In order to debug this, I’ve created a script (found in the bottom of this post) and dumped it in the
web site’s root folder as “sendmail.asp”:
When loading http://localhost/sendmail.asp in a browser:
1. When “smarthost” is set to “127.0.0.1” and “sendusing” is set to “1”, the
mail message is dropped to the mailroot queue folder.
2. When “smarthost” is set to “10.0.0.1” (local SMTP ip-addr) and “sendusing”
is set to “2” or…
3. …when “smarthost” is set to “10.0.0.2” (the smarthost) and “sendusing”
is set to “2”, IIS returns the following error:
CDO.Message.1 error ‘80040213’
The transport failed to connect to the server.
/sendmail.asp, line 30
When executing sendmail.vbs (sendmail.asp as vbscript) from the command line (as local admin):
4. smarthost=localhost, sendusing=1 => mail message is dropped to the mailroot queue folder.
5. smarthost=10.0.0.1, sendusing=2 => mail message is dropped to the mailroot queue folder.
6, smarthost=10.0.0.2, sendusing=2 => mail sent directly to smarthost, over the internet to recipient.
In cases 1, 4 and 5, I find this in the system eventlog:
event id: 4006
Message delivery to the host ‘10.0.0.2’ failed while delivering to the
remote domain ‘
server did not respond to a connection attempt.
10.0.0.1 : windows server 2003 standard edition running iis 6.0 with www/smtp
SMTP-service is setup to relay from 127.0.0.1 and 10.0.0.1
Access (anonymous) to SMTP on this box only from 127.0.0.1 and 10.0.0.1
10.0.0.2 : windows server 200X running lotus domino 6.5
lotus domino is setup to relay from 10.0.0.1
Anyone got any idea of what is causing this error?
Jeff.nospam 2012-08-04 21:56:38
Smart hosts are *other* SMTP servers you relay through. Don’t enter
anything if you use a local SMTP server or send directly to the SMTP
server for delivery. If you are using a local SMTP server, the
SendUsing parameter can be 1, if not, it’s 2.
Espen torgerse 2012-08-04 21:56:44
I know what a SMTP smarthost is 😉
I was referring to the “smarthost” vbscript variable (yes, it has a misleading
name…)in my script – not the IIS/SMTP smarthost – should have taken more care
in pointing that out.
The documentation at
says that when sending mail via a locally installed SMTP-server, the “sendusing”
parameter should be set to “1” and when sending to a remote SMTP-server,
“sendusing” should be set to “2”.
I’ve played around with my sendmail.asp on a server where CDO works, and as far
as I can tell, CDO will simply ignore the “smtpserver” parameter when “sendusing”
is set to “2” – right?
What I find even more confusing is the fact that I’m perfectly able to send mail
(from my to both 127.0.0.1 and the local SMTP-server’s IP when “sendusing” is
set to “2”…why did MS put it into the API in the first place?
The error (from the original post) does only show up when CDO is used in ASP(.NET),
but not when executed on the command line, which leads me to suspect that something
is wrong with the NET framework or IIS or whatever…
I’ll try to re-install aspnet on the website – maybe that’ll help.