IIS and SMTP - Error Sending CDO mail using SMTP

This is Interesting: Free IT Magazines  
Home > Archive > IIS and SMTP > June 2004 > Error Sending CDO mail using SMTP





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Error Sending CDO mail using SMTP
Bill Nguyen

2004-06-01, 4:56 pm

Please take a look at the code below. I kept getting the error message:

CDO.Message.1 error '80040213' - The transport failed to connect to the
server.

Win 2003

IIS 6.0

SMTP configured and pointed to Exchange 5.5 server (mailserver)

I would like to get rid of using schemas.microsoft.com services for
configuration parameters. If you have any example of a workign CDO routine,
please point it to me.

Thank you very much.

Bill



'***************************************
**************

'********************

sub sendMail(fromAddr, recipients,subject, body)

Const cdoSendUsingMethod = _

"http://schemas.microsoft.com/cdo/configuration/sendusing"

Const cdoSendUsingPort = 2

Const cdoSMTPServer = _

"http://schemas.microsoft.com/cdo/configuration/smtpserver"

Const cdoSMTPServerPort = _

"http://schemas.microsoft.com/cdo/configuration/smtpserverport"

Const cdoSMTPConnectionTimeout = _

"http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"

Const cdoSMTPAuthenticate = _

"http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"

Const cdoBasic = 1

Const cdoSendUserName = _

"http://schemas.microsoft.com/cdo/configuration/sendusername"

Const cdoSendPassword = _

"http://schemas.microsoft.com/cdo/configuration/sendpassword"

Dim objConfig ' As CDO.Configuration

Dim objMessage ' As CDO.Message

Dim Fields ' As ADODB.Fields



Set objConfig = Server.CreateObject("CDO.Configuration")

Set Fields = objConfig.Fields

With Fields

..Item(cdoSendUsingMethod) = cdoSendUsingPort

..Item(cdoSMTPServer) = "mailserver" ' This is an Exchange server

..Item(cdoSMTPServerPort) = 25

..Item(cdoSMTPConnectionTimeout) = 10

..Item(cdoSMTPAuthenticate) = cdoBasic

..Item(cdoSendUserName) = "userIDr"

..Item(cdoSendPassword) = "password"


..Update

End With

Set objMessage = Server.CreateObject("CDO.Message")

Set objMessage.Configuration = objConfig

With objMessage


..To = recipients

..From = fromAddr

..Subject = subject

..HTMLBody = body

..Send

End With

Set Fields = Nothing

Set objMessage = Nothing

Set objConfig = Nothing

end sub


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com