Send eMails from your Android device using Tasker & Python…

I have previously written about Tasker for Android, the powerful automation utility, and how it can be used amongst other things, to detect headphone state. Since then the application has evolved to include the ability to create standalone applications and support Javascript in assembly’s. Scripting support is not a new thing for Tasker having always supported SL4A (Scripting Layer for Android) and its this ability that allows us even more power…

One of the earliest services I wanted from Tasker was to send eMail however default this is not available by default so outside assistance was required. This where SL4A and the Python add-on come in…

The following describes the process  went through to get this working on both versions 4 (ICS) & 4.1 (Jellybean)

Installing the Scripting Layer & Python

  • You will need to allow your device to install applications from outside the Play Store. (Please note that you will do this at your own risk and doing so may revoke warranties etc)
  • Download and install SL4A_R6.APK to your device from the Android-Scripting pages at Google Code site
  • Run the SL4A_R6.APK install
  • Download and install python_for_android_r1.apk to your device again from the  Android-Scripting pages at the Google Code site
  • Run the python_for_android_r1.apk install
  • Open the Python for Android Applicaton from the applications list
  • Press the one and only button titled Install which will complete the install of the Python setup
  • To test the install open SL4A and run the HelloWorld.Py which should flash up the text Hello Android

Testing the SL4A and Python install with the Hello World Script

Adding the Send Email Script

  • From the Tasker Wiki site download the
  • Save the file to the SDCard\SL4A\Scripts folder

Setting up a Tasker Send Mail Task

The Next steps are extracted from the Tasker Wiki Send email with attachments entry.

Create a New Task in Tasker Called Send Mail

Add New Variables for each of the following;

Parameter Required? Description
%EMAIL_NAME No Your name
%EMAIL_USER Yes Your gMail user ID
%EMAIL_PSWD Yes Your gMail password (This is the Application Specific Password not the main account password)
%EMAIL_TO Yes The address to which to send the email
%EMAIL_SUBJECT No The email subject
%EMAIL_BODY No The text of the email message
%EMAIL_ATTACH No A comma-separated list of files to be attached.

Now Add a New Action, Scripts, Run SL4A Script

In the Action settings;

  • enter the name of the Python Send Mail file SendMailA.PY
  • Untick Terminal
  • Enter the Variables to pass to the script as one line comma separated

Save all Actions and Tasks by ticking the Green Ticks

Creating a Profile to run the script

Now that the Task exists a Profile needs to be created to make use of the new Task.

When I am at a work location my personal phone tends to stay silent so when I receive text from my wife, an Email is generated forwarding the message to my work email account, ensuring I never miss those VIP messages 🙂 !!

Thanks to Baudi on the Tasker Wiki for this setup


4 thoughts on “Send eMails from your Android device using Tasker & Python…

  1. Pingback: Send SMS through your shell. | bergslog

  2. I tried to run it, but it doesn’t work yet. %EMAIL_USER does it have to be s*** or only s***. %EMAIL_PWSD app-specific password isn’t the same as the main account ?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s