sending email script

Talk about computers, electronics, hardware, software, etc
Forum rules
Please do not advertise any websites here or shorten your links in the Lounge. Any spam will be deleted and accounts banned.
Post Reply
User avatar
David9999
Pro Member
Posts: 119
Joined: Thu Apr 11, 2013 6:46 am
Location: Inside The Money Machine
Contact:

sending email script

Post by David9999 » Thu May 09, 2013 5:29 am

pmsg := ComObjCreate("CDO.Message")
pmsg.From := """AHKUser"" <[email protected]>"
pmsg.To := "[email protected]"
pmsg.BCC := "" ; Blind Carbon Copy, Invisable for all, same syntax as CC
pmsg.CC := "[email protected], [email protected]"
pmsg.Subject := "Message_Subject"

;You can use either Text or HTML body like
pmsg.TextBody := "Message_Body"
;OR
;pmsg.HtmlBody := "<html><head><title>Hello</title></head><body><h2>Hello</h2><p>Testing!</p></body></html>"


sAttach := "Path_Of_Attachment" ; can add multiple attachments, the delimiter is |

fields := Object()
fields.smtpserver := "smtp.gmail.com" ; specify your SMTP server
fields.smtpserverport := 465 ; 25
fields.smtpusessl := True ; False
fields.sendusing := 2 ; cdoSendUsingPort
fields.smtpauthenticate := 1 ; cdoBasic
fields.sendusername := "[email protected]"
fields.sendpassword := "your_password_here"
fields.smtpconnectiontimeout := 60
schema := "http://schemas.microsoft.com/cdo/configuration/"


pfld := pmsg.Configuration.Fields

pfld.Item(schema . field) := value
pfld.Update()

Loop, Parse, sAttach, |, %A_Space%%A_Tab%
pmsg.AddAttachment(A_LoopField)
pmsg.Send()

Post Reply