SendMail
Remember to enable Mail Relay on a SMTP server
strMailFrom = "no-reply@yourcompany.com"
strMailTo = "someone@somecompany.com"
strSMTPRelay = "smtp relay server name or IP address"
strTextBody = "Body of your email"
strSubject = "Subject line"
strAttachment = "full UNC path of file"
Set oMessage = CreateObject("CDO.Message")
oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTPRelay
oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
oMessage.Configuration.Fields.Update
oMessage.Subject = strSubject
oMessage.From = strMailFrom
oMessage.To = strMailTo
oMessage.TextBody = strTextBody
oMessage.AddAttachment strAttachment
oMessage.Send
|