Call the Sub - passing in the message you want.
Sub SendEmail(message)
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML
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 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
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail71.safesecureweb.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 15
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "root@logsitall.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "XXXX"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
.Update
End With
' Build HTML for message body.
strHTML = message
' Apply the settings to the message.
With iMsg
Set .Configuration = iConf
.To = "billp@hmc2agency.com"
.Cc = "wkpatton@aol.com"
.Sender="admin@logsitall.com"
.From = "admin@logsitall.com"
.Subject = "Subject line using sub"
.HTMLBody = strHTML
End With
iMsg.Send
' Clean up variables.
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
'MsgBox "Mail Sent!"
End Sub
No comments:
Post a Comment