CDO script / auth

hafa

Perch
There is likely a simple solution to this, but I've not yet stumbled upon it so am posting here:

I'm trying to get CDO to play nice with AOL, so am using the following script as a test model. Obviously, I'm substituting for mydomain.com. The script returns no errors, but also sends no mails. Any assistance is appreciated...:

Code:
Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).

Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Example CDO Message"
objMessage.From = "[email protected]"
objMessage.To = "[email protected]"
objMessage.TextBody = "This is some sample message text.." & vbCRLF & "It was sent using SMTP authentication."

'==This section provides the configuration information for the remote SMTP server.

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.mydomain.com"

'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic

'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "[email protected]"

'Your password on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypassword"

'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587

'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False

'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==

objMessage.Send

Please note that I've tried both port 587 and 25, as well as changing the value of Const cdoAnonymous to 1.
 
Are you sure its not being sent... or is it a problem with reciever - code looked OK so I copied it to my server and replaced the username/password/smtp server with my own (and changed smtp port to 25) and it came through fine.
 
Penhall said:
Are you sure its not being sent... or is it a problem with reciever - code looked OK so I copied it to my server and replaced the username/password/smtp server with my own (and changed smtp port to 25) and it came through fine.

Strange. Yeah, it's definitely not making it through; I've hard-coded the "to" address with one of my most consistently used accounts on the same mail server, but no joy...
 
I purposely hard coded the to address field to a non-JH hosted account so its external and it came through. Didn't check with intra-Jodo delivery.

At least we know your code is fine.
 
I am confused here:
Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).


> Why BOTH, it is either or option here, you need to use 1, OR 2, not both, for SMTP Auth via a mail server you need 2.

Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM

> if you use 0 or 2 it wont work, if using SMTP Auth, you must use 1, I don't understand why you have all options here. 0 could work using localhost, but AOL at this point(should be resolve in a few days on al servers) does not accept mail from non rDNSed servers, that is why you would utilize SMTP Auth, to have SMTP Auth.
 
I think the second ones are just constants pulled from a generic script - the cdoBasic constant is being called later:

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic

The first part is assigned to the constants then hard coded to '2' later in the code instead of cdoSendUsingPort constant
 
Penhall said:
No probs -- I had to do a double take when I first glanced at the script too.

What can I say, just a quick and dirty cut and paste for a test; I'll clean up the extraneous bits before production just to keep maintenance easier...

The script did work, it was just jodohost's (receiving) mail servers getting another case of constipation which delayed the messages by about 2 hours...
 
At the time you sent this, one of the mail servers had been rebooted for hardware changes a couple hours before and was having high load. I don't know of any other mail delays today.

Good news is there were NO timeouts, and the load leveled off about 2 by a bit after you posted this message :)
 
Back
Top