CDO and SMTP Servers

  • Thread starter Thread starter animedreamer
  • Start date Start date
A

animedreamer

I am working on an application where I want to allow a user to send a
message to multiple customers at once. I stumbled across CDO and have
some questions regarding how it works. I found the following code on
Microsoft's web site:

'***********************************************************************************************************
set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")

Set Flds = iConf.Fields

' Set the CDOSYS configuration fields to use port 25 on the SMTP
server.

With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") =
cdoSendUsingPort
'ToDo: Enter name or IP address of remote SMTP server.
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= "<remote SMTP server>"

..Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")
= 10
.Update
End With
'***********************************************************************************************************

You can specify a SMTP server in the code. My questions is, does this
SMTP server have to be the SMTP server that the recipient uses to
retrieve his or her e-mail or can this be the SMTP server through which
I wish to send the e-mail? My initial testing seems to suggest the
former. Is the latter possible? If so, how do you authenticate
yourself to the SMTP server through which you are sending the e-mail?
Thanks for any and all help.

-Vincent
 
It can be any SMTP server. CDO for Windows has no relationship with the user's mail accounts. I think MSDN has documentation that explains the authentication possibilities. It's a bit outside the scope of this newsgroup, which deals with OUtlook programming.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
(e-mail address removed) wrote in
You can specify a SMTP server in the code. My questions is, does this
SMTP server have to be the SMTP server that the recipient uses to
retrieve his or her e-mail or can this be the SMTP server through
which I wish to send the e-mail? My initial testing seems to suggest
the former. Is the latter possible? If so, how do you authenticate
yourself to the SMTP server through which you are sending the e-mail?

It definitely doesn't have to be the server that the recipient uses --
the whole point of SMTP is that you send your mail off to the SMTP
server that the _sender_ uses, and then servers take care of getting it
from place to place until it arrives at the recipient's server, and then
the recipient gets it from there however they do that.

So as long as you know that the person running the _sending_ code can
send mail through the smtp server specified in the code, you're okay.

If the person running the sending code may vary, things are more
complex. You have two options:

1. Let them enter the server that they would usually use (and then deal
with getting that info into your code).

2. Use a fixed server -- but this is risky, because then the fixed
server has to be open to everyone (ie spam) or use authentication, and
I'm not sure how you do authentication with CDOSYS -- there may be
something in schemas.microsoft.com somewhere, though.

-- dan
 
Back
Top