How can I make this script work?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
magicinmath
Posts: 162
Joined: 12 Apr 2017, 23:03

How can I make this script work?

23 Apr 2017, 16:16

Trying to get Sean's code for gmail to work found here:
https://autohotkey.com/board/topic/3652 ... -delivery/

I get this error:
Untitled.png
Untitled.png (26.15 KiB) Viewed 1009 times
For quicker reference, this is the code:

Code: Select all

sFrom	  := "Mail_Address_Of_Sender"
sTo	    := "Mail_Address_Of_Receipient"
sSubject  := "Message_Subject"
sBody	  := "Message_Text"
sAttach	:= "Path_Of_Attachment" ; can add multiple attachments, the delimiter is [color=red]|[/color]

sServer   := "smtp.gmail.com" ; specify your SMTP server
nPort     := 465 ; 25
bTLS      := True ; False
nSend     := 2	; cdoSendUsingPort
nAuth     := 1	; cdoBasic
sUsername := "your_username"
sPassword := "your_password"

COM_Init()
pmsg :=	COM_CreateObject("CDO.Message")
pcfg :=	COM_Invoke(pmsg, "Configuration")
pfld :=	COM_Invoke(pcfg, "Fields")

COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/sendusing", nSend)
COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout", 60)
COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/smtpserver", sServer)
COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/smtpserverport", nPort)
COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/smtpusessl", bTLS)
COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", nAuth)
COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/sendusername", sUsername)
COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/sendpassword", sPassword)
COM_Invoke(pfld, "Update")

COM_Invoke(pmsg, "From", sFrom)
COM_Invoke(pmsg, "To", sTo)
COM_Invoke(pmsg, "Subject", sSubject)
COM_Invoke(pmsg, "TextBody", sBody)
Loop, Parse, sAttach, |, %A_Space%%A_Tab%
COM_Invoke(pmsg, "AddAttachment", A_LoopField)
COM_Invoke(pmsg, "Send")

COM_Release(pfld)
COM_Release(pcfg)
COM_Release(pmsg)
COM_Term()
Thanks for your help!
Last edited by magicinmath on 23 Apr 2017, 22:14, edited 3 times in total.
User avatar
Almost_there
Posts: 404
Joined: 30 Sep 2014, 10:32

Re: How to install standard library and make this script work?

23 Apr 2017, 18:27

Haven't used this specific library before, but I suggest you put the library in the same directory as the ahk file. Then see if it works.
magicinmath
Posts: 162
Joined: 12 Apr 2017, 23:03

Re: How to install standard library and make this script work?

23 Apr 2017, 18:59

Actually, that much works, I confirmed by running easy scripts that would need the library and they work.

Still don't get why the gmail script won't work :(

Thanks for your reply.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Rohwedder and 55 guests