WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Postie

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

CDO to Send SSL Email

 Keywords: send mail sendmail email SSL TSL Authentication GMAIL Postie 


;***************************************************************************
;**   CDO Send Mail Using SSL
;** 
;** 
;** Purpose:   Send Email via GMAIL SMTP server using SSL 
;** 
;** This code requires CDO: http://support.microsoft.com/?kbid=171440
;** CDO gets installed by default with many of the following applications:
;** Outlook, Exchange, IIS, Windows 2000, Windows 2003   
;** 
;** This code expects you to have ENABLED SMTP in your GMAIL settings
;** 
;** Revisions: 2009.10.30 Deana Falk
;***************************************************************************


cdoSendUsingPickup = 1 ;Send message using the local SMTP service pickup directory. 
cdoSendUsingPort = 2 ;Send the message using the network (SMTP over the network). 
cdoAnonymous = 0 ;Do not authenticate
cdoBasic = 1 ;basic (clear-text) authentication
cdoNTLM = 2 ;NTLM

objMessage = CreateObject("CDO.Message") 
objMessage.Subject = "Example CDO Message" 
objMessage.From = "me@my.com" 
objMessage.To = "test@soandso.com" 
objMessage.TextBody = "This is some sample message text.." : @CRLF : "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") = "smtp.gmail.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") = "youruserid"

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

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

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

;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

objMessage.Send

Exit




Article ID:   W17586
Filename:   CDO to Send SSL Email.txt
File Created: 2017:07:28:12:58:34
Last Updated: 2008:10:30:13:21:22