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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using CDO for e-mail 3

Status
Not open for further replies.

RonRepp

Technical User
Feb 25, 2005
1,031
US
Hi all:

Some of you have answered my past 2 threads on vbSendMail (thread222-1505112) and Email Security (thread222-1505888), so I'm again hoping for your help.

I've done some studying and found that CDO may be the way to go, but I'm still having problems with security. It seems the SSL is there, but not the TLS.

Code:
Dim iMsg As New CDO.Message
Dim iConfg As New CDO.Configuration
Set iConfg = New CDO.Configuration
Set Flds = iConfg.Fields


schema = "[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/"[/URL]
Flds.Item(schema & "sendusing") = 2
Flds.Item(schema & "smtpserver") = "mail.SMTP.com"
Flds.Item(schema & "smtpserverport") = 465
Flds.Item(schema & "smtpauthenticate") = 1
Flds.Item(schema & "sendusername") = "someone@somewhere.com"
Flds.Item(schema & "sendpassword") = "Password!"
Flds.Item(schema & "smtpusessl") = 1
Flds.Item(schema & "smtpusetls") = 1
Flds.Update

With iMsg
    .HTMLBody = "<HTML>Test</HTML>"
    .Subject = "CDO Test"
    .To = "Me@Source.tv"
    .From = "CS@Mask.com <someone@somewhere.com>"
    .Sender = "Mask"
    .ReplyTo = "CS@Mask.com"
Set .Configuration = iConfg
    .Send
End With
''Receives error:
''The Transport failed to connect with the server

Any Help will be greatly appreciated

Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.

My newest novel: Wooden Warriors
 
Looks like your missing one:

Flds.Item(schema & "enablessl") = 1

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
That's the name of the System.Net.Mail SSL enabler, isn't it, George? We're on CDO for Windows 2000, where the config field should be smtpusessl, which Ron is using.
 
George and StrongM:

Good thought, but I get the same error.

I'm going to speak to my SA and make sure I have the correct credentials.

In the meantime, enjoy a star on me. I really appreciate the help.



Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.

My newest novel: Wooden Warriors
 
The field names are defined in type information within the CDOSYS library, as well as enums for many of the setting values. You don't need to redefine them. cdoSMTPUseSSL is Boolean, not numeric. Of course it is probably being coerced for you... maybe?:

[tt]Flds!cdoSMTPUseSSL = True[/tt]

I notice you haven't specified a connection timeout, perhaps something like:

[tt]Flds!cdoSMTPConnectionTimeout = 60[/tt]

The default is 30 and often isn't enough.

"Use SSL" in this context implies TLS. There is no "Use TLS" field.
 
Thanks to everyone involved.

It is finally up and running.

Diletante: Good thought on the timeout. I actually did find it on the MS site, but didn't think it would matter that much. Wrong again.

Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.

My newest novel: Wooden Warriors
 
Good to hear.

I'd have thought 30 seconds to be plenty myself, but go figure!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top