Attaching files or using a variable in email function.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
VI Services

Attaching files or using a variable in email function.

19 Sep 2017, 17:13

This functionality is new to me, so hopefully it's something simple I'm just not grasping.
Here's what the script does,
When a user logs off the script a Var is created with the users daily report activities. This report is assigned to Var "MyVar" in the example. I want the script to send the var with it's information. However, the email reads "%MyVar%"
not the information in the var.

Code: Select all

 
 MyVar = MyVar
MyVar := "JAMES"




SendGmail("Test %myVar%","[email protected]")
ExitApp

SendGmail(message,emailto){	
	pmsg := ComObjCreate("CDO.Message")
	pmsg.From := """[VI Services]"" <[email protected]>"
	pmsg.To := emailto
	pmsg.Subject := ""
	pmsg.TextBody := message
	fields := Object()
	fields.smtpserver := "smtp.gmail.com"
	fields.smtpserverport := 465
	fields.smtpusessl := True
	fields.sendusing := 2
	fields.smtpauthenticate := 1
	fields.sendusername := "[email protected]"
	fields.sendpassword := "password6"
	fields.smtpconnectiontimeout := 60
	
	schema := "http://schemas.microsoft.com/cdo/configuration/"
	pfld := pmsg.Configuration.Fields
	For field,value in fields
		pfld.Item(schema . field) := value
	pfld.Update()
	pmsg.Send()
	pmg.Close
}
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Attaching files or using a variable in email function.

20 Sep 2017, 01:48

SendGmail("Test " . myVar, "[email protected]")

Check out how to use a var in an :arrow: expression :)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mikeyww and 282 guests