Gmail sending email

Get help with using AutoHotkey and its commands and hotkeys
Posts: 162
Joined: 12 Apr 2017, 23:03

Gmail sending email

21 Apr 2017, 18:58

I do not take credit for this code, I found it, I can't get it to work. Is it possible to make it work still?

I am currently using Version

The following is the source code:

Code: Select all

pmsg 						:= ComObjCreate("CDO.Message")
pmsg.From 					:= """from"" <>"
pmsg.To 					:= ""
pmsg.BCC 					:= ""   									; Blind Carbon Copy, Invisible for all, same syntax as CC
pmsg.CC 					:= ""										; [email protected], [email protected]
pmsg.Subject 					:= "See below"
;pmsg.TextBody 					:= ""
pmsg.HtmlBody 					:= "<html><head><title>Hello</title></head><body><table border='1'><tr><td>row 1, cell 1</td><td>row 1, cell 2</td></tr><tr><td>row 2, cell 1</td><td>row 2, cell 2</td></tr></table> </body></html>"
;sAttach   					:= "" 										; can add multiple attachments, the delimiter is |
fields 						:= Object()
fields.smtpserver   				:= "" 						; specify your SMTP server
fields.smtpserverport   			:= 465 										; 25
fields.smtpusessl      				:= True 									; False
fields.sendusing     				:= 2   										; cdoSendUsingPort
fields.smtpauthenticate 			:= 1   										; cdoBasic
fields.sendusername 				:= ""
fields.sendpassword 				:= ""
fields.smtpconnectiontimeout			:= 60
schema 						:= ""
pfld 						:=  pmsg.Configuration.Fields
For field,value in fields
	pfld.Item(schema . field) 		:= value
Loop, Parse, sAttach, |, %A_Space%%A_Tab%
Any explanation would be greatly appreciated. It's possible I didn't install Com right.

I got the source here: ... d-library/

Saved it in a file called com.ahk in the same directory as the script and used: #include filepath/com.ahk

I get this error when I run it:
Capture.PNG (39.86 KiB) Viewed 726 times
I've gone to the link: which doesnt work.

I'm really confused and would love help.

User avatar
Posts: 44
Joined: 09 Jun 2015, 21:08

Re: Gmail sending email

21 Apr 2017, 20:30

I haven't tried it, but it looks like you're using google's SMTP server. If you don't have your own, you should try to look up the conditions of using their SMTP service.
Looks like you might need to specify your gmail address and password when using it. ... mtp-server
Posts: 162
Joined: 12 Apr 2017, 23:03

Re: Gmail sending email

21 Apr 2017, 20:48

I double checked and all of the settings in the script match the gmail smtp, also put in my pass and email and all other fields it asks me to fill out.

Return to “Ask For Help”

Who is online

Users browsing this forum: andre900, Google [Bot], haichen, mikeyww, RamonArgentina, Wanion, zvit and 33 guests