tags:

views:

15

answers:

2

I am using cdo to send email the following code fails

Set cdoConfig = CreateObject("CDO.Configuration")

With cdoConfig.Fields
    .Item(cdoSendUsingMethod) = cdoSendUsingPort
    .Item(cdoSMTPServer) = "localhost"
    .Update
End With 

When I send an email I get the following error

8004020f

I then changed the code to the following:

Set cdoConfig = CreateObject("CDO.Configuration")

With cdoConfig.Fields
    .Item(cdoSendUsingMethod) = cdoSendUsingPickup
    .Item(cdoSMTPServer) = "localhost"
    .Update
End With 

The email sends without a problem. What steps could I take to troubleshoot why cdoSendUsingPort is not working?

A: 

Professor Google finds (in order):
- Several options: server disallows anonymous relaying, server rejects specific recipient domains, recipient is rejected by SMTP server in unexpected way, and/or proxy or firewall settings are blocking the mail.
- Your mailserver is configured to not relay from your source machine.
- ... and several more things which boil down to the first link listed.

Some of these things you can test directly by telnet-ing from the sending machine to the mailserver, performing a normal SMTP interaction, and seeing what messages are displayed.

Eric Towers
A: 

With cdoSendUsingPort, CDO tries to open a connection to the SMTP server you specify (in your case, localhost) on TCP port 25. I guess you're not running an SMTP server on your machine, so nothing is listening on port 25 and the call fails.

With cdoSendUsingPickup, CDO forwards the message to the pickup directory of your local IIS instance for later processing. I guess you have IIS installed on your machine and its SMTP module is configured to use pickup, so the call succeeds.

Frédéric Hamidi