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

CDO mail security when sending thru remote SMTP server 1

Status
Not open for further replies.

myatia

Programmer
Nov 21, 2002
232
Hi, all,

I need to send an email out an a webserver that does not have an SMTP server running. I'm using CDO mail to send the email out through another remote server, and was wondering if there are any security or reliablity issues, as the script appears to access an outside web site (schemas.microsoft.com, see code below). Also, are there any other alternative ways to send email through a remote server? Any advice would be appreciated. Thanks,

Misty

Code:
With MailObj
     '// To, from, subject, etc. settings here

     .Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2

     .Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = "MAIL_SMTP_SERVER"

      .send
end with
 
I have been doing that with CDO for about a year now and have no problems. In fact I even have it working on an secured connection with certificates. Only thing to remember is your authentication to the domain.

Here is my code for sending mail:

Code:
dim m_objCDO 'Mail protocol
dim m_objCDOMessage 'E-mail message to be sent
dim cdoFields 'Fields used to configure CDO object

Const cdoSendUsingMethod = "[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing"[/URL]
Const cdoSendUsingPort = 2
Const cdoSMTPServer = "[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver"[/URL]
Const cdoSMTPServerPort ="[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport"[/URL]
Const cdoSMTPConnectionTimeout = "[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"[/URL]
Const cdoSMTPAuthenticate =	"[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"[/URL]
Const cdoBasic = 1
Const cdoSendUserName =	"[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusername"[/URL]
Const cdoSendPassword =	"[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendpassword"[/URL]

Set m_objCDO = Server.Createobject("CDO.Message")
Set m_objCDOcon = Server.Createobject("CDO.Configuration")

'Sending email notification
set Fields = m_objCDOcon.Fields 

'Setting up Message parameters
with Fields
	.Item(cdoSendUsingMethod)       = cdoSendUsingPort
	'Replace with your SMTP server
	.Item(cdoSMTPServer)            = "smtp.server.com"
	.Item(cdoSMTPServerPort)        = 25
	.Item(cdoSMTPConnectionTimeout) = 10
	'Only used if SMTP server requires Authentication
	'.Item(cdoSMTPAuthenticate)      = cdoBasic
	'.Item(cdoSendUserName)          = "domain\username"
	'.Item(cdoSendPassword)          = "password"
	.Update
end with

'Passing parameters to message object
Set m_objCDO.Configuration = m_objCDOcon

With m_objCDO
	'Replace with email you wish the message to be sent to
	.To       = "email@email.net"
	'Replace with email you wish the message to be from
	.From     = "email@email.net"
	'Replace with subject
	.Subject  = "Subject"
	'Replace with information you want to be sent
	.HTMLBody = "Email Body"   
	.Send
End With
%>

If your really worried about securing the communication setup a tunnel to the remote server using a secured port with certificates and then send your mail like your local on the network.

Let me know if have any other questions.

Cassidy
 
Thanks for your response, Cassidy. It's good to know it will work on a secure server.

I looked through some documentation, and found that the "URLs" in the code are actually names of fields in a namespace. It's all done in XML, where I guess it's typical to use URLs in this way. If you go to any of the URLs in the code, you'll get a 404 error, but if you go to the root ( you'll get documentation on the namespace.

Along with the documentation link above, this article on namespaces was also helpful, if anyone else is wondering...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top