Forum Discussion
vex
13 years agoContributor
I never got this to work when I tried it unless I used a non-secure smtp port (which was ok, we were only sending out generic emails and nothing confidential at all).
Here is the code from my module that is functional.
Here is the code from my module that is functional.
Sub semail(from, towhom, subject, text)
if from = "" then from = """qa dept"" <qa@DO-NOT-REPLY.com>"
if towhom = "" then towhom = Project.Variables.sdEmailTo
if subject = "" then subject = "No subject specified."
if text = "" then text = "No text specified."
Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).
Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = subject
objMessage.From = from
objMessage.To = towhom
objMessage.TextBody = text
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.xxxxxxxxxxx.com"
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "qa@xxxxxxxxx.com"
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "xxxxxxxxx"
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 26
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 45
objMessage.Configuration.Fields.Update
objMessage.Send
End Sub