Groups | Blog | Home
all groups > iis smtp nntp > march 2005 >

iis smtp nntp : CDO.Message.1 error 80040213



Espen Torgersen
3/9/2005 12:52:24 PM
Hi,

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
(10.0.0.2).

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:

source: smtpsvc
type: warning
event id: 4006

Message delivery to the host '10.0.0.2' failed while delivering to the
remote domain '<domain_removed>' for the following reason: The remote
server did not respond to a connection attempt.

Setup:

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?

Best regards,
Espen Torgersen


<!-- script start -->
<html>
<head>
<title>SMTP test program</title>
<head>
<body>

<!-- script start -->
<script language="vbscript" runat=server>
dim smarthost

'smarthost="127.0.0.1"
'smarthost="10.0.0.1"
smarthost="10.0.0.2"

Set objEmail = CreateObject("CDO.Message")

objEmail.From = "from@email-addr"
objEmail.To = "to@email-addr"
objEmail.Subject = "Test of SMTP on SMTPSERVER=" & smarthost
objEmail.Textbody = "This is the mail message body."
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smarthost
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoAnonymous ' =0
''objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic 'cdoAnonymous ' =0
''objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "<user>"
''objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "<password>"

objEmail.Configuration.Fields.Update
objEmail.Send

</script>
</body>
</html>
<!-- script stop -->

jeff.nospam NO[at]SPAM zina.com
3/9/2005 5:22:55 PM
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.

Jeff

On Wed, 09 Mar 2005 12:52:24 +0100, Espen Torgersen <no@you.dont>
[quoted text, click to view]
Espen Torgersen
3/10/2005 11:25:09 AM
Hi Jeff,

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
http://www.microsoft.com/technet/scriptcenter/guide/sas_ent_wbpa.mspx
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.

AddThis Social Bookmark Button