How To Remotely Trigger A Torrent Download Via Email [Mac]

Ads by Google

For a long time now, I’ve been searching for a way to start a torrent download from a remote location. And since I’m on the road most of the day, Transmission’s WebUI isn’t any good to me. I couldn’t be bothered to set it up anyway, it would involve having a fixed IP address or DynDNS — too much hassle to being with. What I actually needed was a simple way to download a torrent on my iPhone and send it to my Mac running at home.

When I realised that the iPhone didn’t support downloading files natively, I was back to square one. Then I thought of using Dropbox — but that didn’t work. After a couple of hours of research, I finally found a solution, albeit a pretty rudimentary one. It involves a secondary email, Mail rules, Transmission or uTorrent and Applescript. Now, let’s be clear on this: I’m not a scripting geek. I’m just an average Mac user. But the fact that I actually wrote this script is a clear testament to how easy it is to learn the Applescript language. I digressed.

Here’s how I managed to set up Mail and Transmission to automatically download torrents sent via email.

First of all, we need to write the script. But since this is MakeUseOf, I’ve already written it for you. Download the appropriate version depending on which torrent client you use.

Download Applescript: Transmission via email

Download Applescript: uTorrent via email

Unzip the file and store the script somewhere safe, for example within the scripts folder located at /Library/Scripts/.

Ads by Google

If you prefer to compile the script yourself, here’s how it looks like:

(*Transmission via email by Jackson Chung*)

using terms from application “Mail”
on perform mail action with messages theMessages for rule Torrent
tell application “Mail”
repeat with theMessage in theMessages
set theText to content of theMessage
set the clipboard to (theText)
end repeat
end tell

tell application “Transmission” to activate
tell application “System Events”
tell process “Transmission”
keystroke “u” using {command down}

keystroke (theText)
key code 36
end tell

end tell
end perform mail action with messages
end using terms from

Before we proceed, let me explain that we are going to set a rule to detect torrents sent from a primary email to a secondary email. So in this case, you’ll need to 2 separate email accounts.

Now launch Mail (assuming you inherently use Mail; if not, you’re out of luck) and enter its Preferences. Click on the Rules tab and add a new rule. Name it “Torrent“, then set the condition to “all”, as in “If all of the following conditions are met”. Next, set the rule conditions as you see in the screenshot below:

From – is equal to –
Subject – is equal to – Download torrent

Perform the following actions:

Mark as Read
Run Applescript – Click the choose button and locate the Applescript you’ve just downloaded

Click on OK and click on “Don’t Apply” if asked Do you want to apply your rules to messages in selected mailboxes?

Mail is now set. For every email from with the subject “Download torrent”, it will trigger the Applescript. Perfect, just what we want.

Now, let’s set Transmission. Enter its Preferences and check the box for “Start transfers when added” and make sure to uncheck “Display “adding transfer” options window”. We want Transmission to automatically start torrents without intervention. OK, Transmission is now set as well.

uTorrent’s default settings will do just fine.

Now then comes the interesting part. How do we format the email? It’s pretty simple. The Applescript is set to copy the content of the message so all you need to add is the URL to the torrent. Remove your email signature or it won’t work. From my iPhone, all I do is hold down on a link until the contextual menu appears. I tap on Copy and launch Mail on my iPhone.

Select the appropriate mailbox corresponding to and compose a new message to your secondary email account Enter the subject line: Download torrent — remember that’s one of the triggers.

Then paste the torrent URL into the content of the message and remove everything else i.e. signatures, etc. Click Send and watch the magic happen.

As soon as your Mac receives the email, it will:

    *Mark it as read;
    *Start the Applescript which then;
    *Launches Transmission or uTorrent;
    *Opens a torrent location from a URL;
    *Enters the URL into the field and clicks OK;
    *Starts downloading the torrent.

Since all of the magic happens from within your Mac, it doesn’t really matter how you send the email. Happily, you can do this from any mobile phone with internet connectivity, or from a browser. I hope you’ll find this “hack” useful.

This is my last post of the year before I take a short break from writing. I wish all MakeUseOf readers a Happy New Year!

Join live MakeUseOf Groups on Grouvi App Join live Groups on Grouvi
Mac OSX Tips & Issues
Mac OSX Tips & Issues
252 Members
Mac Troubleshooting
Mac Troubleshooting
107 Members
Apple Hardware Discussion
Apple Hardware Discussion
87 Members
Affiliate Disclamer

This article may contain affiliate links, which pays us a small compensation if you do decide to make a purchase based on our recommendation. Our judgement is in no way biased, and our recommendations are always based on the merits of the items.

For more details, please read our disclosure.
New comment

Please login to avoid entering captcha

Log In