Send Email To Your PDA From the Command Prompt

This tutorial gives you a couple of scripts that allow you to send a short message to your PDA via a proxy on your personal web hosting provider. I created it today because I wanted a quick way to copy a URL from my browser, paste it somewhere, and have it end up on my Blackberry. (The URL in question today happens to be the mobile version of H2G2, the Hitchhiker’s Guide to the Galaxy for the real world.)

You will need:

  • A desktop or laptop computer with Python installed
  • Access to a web hosting provider (your personal web site) which can run PHP scripts
  • A PDA that can receive email

You might be wondering why I didn’t simply build a script to send mnail directly from my desktop via SMTP to my personal email provider. The reason for this is that SMTP from an end-user’s computer is problematic. In some places where you take your computer you might be blocked by firewalls. Plus, it can be difficult or impossible to establish SMTP access to most free email providers. On the other hand, I happen to have a personal web host (as do a lot of other people) and scripts that reside there can reliably send email.

The Client Script

Put this script on your desktop somewhere accessible from your $PATH environment variable.

Filename: mailpda

mailpda "http://www.bbc.co.uk/dna/h2g2/pda/" #Send H2G2

It’s a good idea to use a tool like apg to generate a long, random password. You don’t want someone discovering your script and spamming your PDA.

The Proxy Script

Put this script in the root folder of your personal web space:

Filename: mailpda.php

mailpda #interactive input

(The two email addresses specified in the script can be different addresses or the same address. Just make sure From goes to your PDA.)

Usage Examples

mailpda < some_text_file #send an existing text file
useful_command | mailpda #send the output of a command

[Type Shift + Ins to paste from the clipboard, then Ctrl + D to end input.]

mailpda.py "http://www.bbc.co.uk/dna/h2g2/pda/" #Send H2G2
mailpda.py #interactive input

Or… if you only speak Windows:

mailpda.py < some_text_file #send an existing text file
useful_command | mailpda.py #send the output of a command

[Type Shift + Ins to paste from the clipboard, then Ctrl + Z to end input.]

mailpda.py < some_text_file #send an existing text file
useful_command | mailpda.py #send the output of a command

Leave a Reply

Please view the Comment Policy before submitting a comment.
 

Your email address will not be published. Required fields are marked *