Option explicit
Dim MyMsg
Set MyMsg = CreateObject("CDO.Message" )
''Change the values below to meet your own settings
''Port 25 is used for standard mail. Port 465 or 587 is used for SSL mail
SMTPConfig MyMsg, "smtp.gmail.com", 465, "your gmail user name here", "your password here", True
MyMsg.From = "Sender@Source.com"
MyMsg.To = "Recipient@Destination.com"
MyMsg.Subject = "This is the subject of the email"
MyMsg.TextBody = "This is the body of the email."
' Uncomment following line if your want to attach
' the current job file to the email
' MyMsg.AddAttachment Watch.GetJobFileName
MyMsg.Send
Sub SMTPConfig(msg, srv, port, user, pw,useSSL)
Const cdoFieldPrefix = "http://schemas.microsoft.com/cdo/configuration/"
with msg
.Configuration.Fields.Item (cdoFieldPrefix & "sendusing" ) = 2
.Configuration.Fields.Item (cdoFieldPrefix & "smtpserver" ) = srv
.Configuration.Fields.Item (cdoFieldPrefix & "smtpserverport" ) = port
.Configuration.Fields.Item (cdoFieldPrefix & "sendusername" ) = user
.Configuration.Fields.Item (cdoFieldPrefix & "sendpassword" ) = pw
.Configuration.Fields.Item (cdoFieldPrefix & "smtpauthenticate") = 1
.Configuration.Fields.Item (cdoFieldPrefix & "smtpusessl") = useSSL
.Configuration.Fields.Update
end with
end sub