The bulk of this is in python and you need python 2.7 installed probably. Then open a command window and install the dependencies…
py -m -2 easy_install pyOpenSSL
py -m -2 easy_install pycrypto
py -m -2 easy_install google-api-python-client
Tip- make sure you install the modules to the correct version of python hence the -m -2 for default version of python 2.
Maybe biggest dependency/note is that you need a working google apps account which is not the same thing as a regular gmail account! Google apps is other wise known as google apps for business and costs $5 a month CAD. You need to have admin access to your google apps account and you need to use your google apps email to send the messages. You could probably also use a similar template to access all of the google api :).
Steps to setup your google apps account…
-save the python script (.py) file from https://gist.github.com/timrichardson/1154e29174926e462b7a to a folder
-with any gmail or apps account that has created a developers console account… enable the gmail api under APIs and auth
-under Credentials click add credentials, service account
-click on your new service account credentials and click generate new p12 key
-save that key to your folder with gmail_service_account_api.py
-edit create your own python script as below and replace the client_email with the email from your credentials page
-replace the privatekey_path with the full path including file name and extension of your .p12 key
-enter your use_as_email as your google apps email and the other fields as required!
AHK code subject := "ahk subject" message := "ahk message" python := "C:\Python27\python.exe" run %python% -i "C:\Users\user_name\Desktop\Gmail\service account example\steves.py" "%subject%" "%message%"
#http://stackoverflow.com/questions/27810898/does-the-gmail-api-support-using-oauth-service-accounts #https://gist.github.com/timrichardson/1154e29174926e462b7a import sys from gmail_service_account_api import Google_apps_mail subject=sys.argv message=sys.argv client_email = "firstname.lastname@example.org" privatekey_path = "C:\Users\user_name\Desktop\Gmail\Gmail-blabla.p12" use_as_email = 'email@example.com' gmail = Google_apps_mail(client_email,use_as_email,privatekey_path) sender='email' #this email doesn't seem to do anything to='email' message_text=message message = gmail.CreateMessage(sender, to, subject, message_text) user_id=use_as_email gmail.SendMessage(user_id, message)
Any questions let me know!