specify user+pwd in CDO/CDONTS

L

Lasse Edsvik

Hello

I have a mailserver that requires windows authentication for sending email.

could you guys show me an example of how to specify user and password in
CDO/CDONTS?

i cant configure it to send with no authentication.

TIA
/Lasse
 
E

Egbert Nierop \(MVP for IIS\)

Lasse Edsvik said:
Hello

I have a mailserver that requires windows authentication for sending email.

could you guys show me an example of how to specify user and password in
CDO/CDONTS?

i cant configure it to send with no authentication.
Something like below should work.

Note that CDO is the -backbone- component for Outlook express and for
Exchange (serverside). So, if any mail feature that Outlook Express
supports, can be programmed by you.

code below is non-tested but should be working.

Set myCDO = CreateObject("CDO.Configuration")
with cdoConfig.fields
.item("http://schemas.microsoft.com/cdo/configuration/sendusing").value =
2

..item("http://schemas.microsoft.com/cdo/configuration/smtpserver").value =
"192.168.0.7"

..item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate").val
ue = 1 ' use clear text authenticate

..item("http://schemas.microsoft.com/cdo/configuration/sendpassword").value =
"mypassword"

..item("http://schemas.microsoft.com/cdo/configuration/sendusername").value =
"yourusername"
.update
End With
 
A

Aaron Bertrand [MVP]

Wow, I stand corrected, thanks Egbert! Now off to update all the FAQ
articles that state CDO is incapable of outgoing auth...

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
 
E

Egbert Nierop \(MVP for IIS\)

Aaron Bertrand said:
Wow, I stand corrected, thanks Egbert! Now off to update all the FAQ
articles that state CDO is incapable of outgoing auth...

CDO rocks!
But if you state that in the FAQ, if you have time, check the code :) I
might have forgotten something.
 
L

Lasse Edsvik

Thanks aron and egbert..... works....

btw....... why is this needed?

<!--
METADATA
TYPE="typelib"
UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
NAME="CDO for Windows 2000 Library"
-->

hard to remember that til next time its needed :(

/Lasse
 
A

Aaron Bertrand [MVP]

This is a Type Library that allows you to use named constants. Beats
remembering the number and/or hex values for all the parameters...

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
 
A

Aaron Bertrand - MVP

but its possible do it without it?

Sure, if you want a bunch of statements like this:

CONST cdoBlahBlah = 1
CONST cdoSomethingElse = 5
CONST cdoAnotherThing = 0xH0004
....

Or, if you want to memorize the value for each and know without question
what it means (note that this makes your code much more cryptic).

Or, if you want to use the more verbose, and slightly misleading, URL style,
e.g.

Set cdoConfig = CreateObject("CDO.Configuration")

cdoConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendus
ing") = 2

(But you still have to remember what 2 means! Does that mean local pickup,
or use a specific smtp server?)

You seem to be troubled by the fact that you might have to memorize that
metadata tag? Not sure why you might think that; I certainly don't have it
memorized. You can put that metadata tag in a text file, somewhere easy to
reach, and just copy and paste. Or you can just grab it from
http://www.aspfaq.com/2026 whenever you need it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top