Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cdosys.dll and Basic authentication?

Status
Not open for further replies.

gny

Programmer
Jun 3, 2001
116
SE
I am trying to use Microsoft CDO For Windows 2000 Library (cdosys.dll, version 6.6.6001.18000) for sending email from an Access 2007 application.

Here is my code, somewhat altered for readability etc:
Code:
        Dim oCDOMessage As New CDO.Message
        Dim oCDOConfig As New CDO.Configuration

        oCDOConfig.Fields.Item(cdoSendUsingMethod) = CdoSendUsing.cdoSendUsingPort 
        oCDOConfig.Fields.Item(cdoSMTPServer) = "smtp.example.com"
        oCDOConfig.Fields.Item(cdoSMTPServerPort) = 25
        oCDOConfig.Fields.Item(cdoSMTPAuthenticate) = cdoBasic
        
        oCDOConfig.Fields.Item(CDOSendUserName) = "UserName"
        oCDOConfig.Fields.Item(CDOSendPassword) = "Password"

        oCDOConfig.Fields.UPDATE
        
        With oCDOMessage
            .To = "test@example.com"
            .Subject = "Subject"
            .TextBody = "Body"
                        
            .From = "testsender@example.com"
            .ReplyTo ="testreplytoaddress@example.com"
            
            .Configuration = oCDOConfig
                    
            .Send
                   
        End With

Anonymously sending emails works just fine, but when I specify that Basic authentication be used (as in the above code) I receive an error: "The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available"

Analyzing the SMTP dialog I come up with this:
Code:
[red]EHLO DEV3[/red]
[blue]
250-smtp.example.com Hello DEV3 [xx.xxx.xxx.xx], pleased to meet you.

250-ENHANCEDSTATUSCODES

250-SIZE 104857600

250-EXPN

250-ETRN

250-ATRN

250-DSN

250-CHECKPOINT

250-8BITMIME

250-PIPELINING

250-AUTH CRAM-MD5 PLAIN LOGIN DIGEST-MD5

250-STARTTLS

250 HELP
[/blue]
[red]AUTH LOGIN[/red]

[blue]334 VXNlcm5hbWU6[/blue]

The last line is the SMTP server urging the client (CDO) to specify a user name.
The next step in the dialog would normally be the client (CDO) specifying the user name (Base64 encoded).
So it seems that CDO raises an error when it tries to supply this to the SMTP server.


I can send email using the same SMTP server and Basic authentication with the same credentials from Outlook or using Telnet, so the problem clearly seems to be with the client.

I can replicate the error on Windows 7 32bit as well as Windows Server 2008 64bit.

Any thoughts on what might be the problem?

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top