Table of Contents
= Send Text Messages (SMS) via your Vodafone/o2 Account =
www.vodafone.ie allows you to send 300 free text messages per month, via their website. Instead of having to logon to their website, vodasms (also called o2sms or meteorsms) has been packaged up, via apt, to allow you to send Text Messages via the linux command line.
Install o2SMS (vodasms)
//Add the following line:
deb http://apt.mackers.com/ unstable contrib
apt-get install o2sms
===== To verify the package signature =====
cat gnupg.key.asc | apt-key add -
Now there wont be any warnings when apt-get updating. With apticron, I was getting annoying daily emails about not verifying the o2sms package signature. Its on the following page if you read closely: http://www.mackers.com/projects/o2sms/docs/v3/install.html
So apt.mackers.com is gone for the past few years. To install it, its a little more complicated as it requires doing a little compiling. (I looked into other ways including cpan -i, however doing a wget and a make is the cleanest). The following was done on a vanilla install of debian squeeze.
Initial Download and initial check for prerequisites
mkdir ~/o2sms cd o2sms elinks http://sourceforge.net/projects/o2sms/files/o2sms-3.36.tar.gz/download #Do a Save gunzip o2sms-3.36.tar.gz tar -xvf o2sms-3.36.tar cd o2sms-3.36 #as per http://o2sms.sourceforge.net/install.html perl Makefile.PL #Checking if your kit is complete… #Looks good #Warning: prerequisite Crypt::SSLeay 0 not found. #Warning: prerequisite IO::Socket::SSL 0 not found. #Warning: prerequisite Net::SSLeay 0 not found. #Warning: prerequisite TestGen4Web::Runner 0.11 not found. #Writing Makefile for o2sms
apt-get install libcrypt-ssleay-perl libnet-ssleay-perl libio-socket-ssl-perl
cd ~/o2sms wget http://cpan.mirror.cdnetworks.com/authors/id/M/MA/MACKERS/TestGen4Web-Runner-0.11.tar.gz gunzip TestGen4Web-Runner-0.11.tar.gz tar -xvf TestGen4Web-Runner-0.11.tar cd TestGen4Web-Runner-0.11 perl Makefile.pl #Warning: prerequisite XML::Simple 0 not found.
apt-get install libxml-simple-perl perl Makefile.pl make apt-get install make make make install
Complete Compile of o2sms
With all the prerequisites installed, all is easy. cd ~/o2sms/o2sms-3.36 perl Makefile.pl make make install
Most files are copied to: /usr/local/bin and /usr/local/share/perl/
Refs: <br> http://o2sms.sourceforge.net/install.html <br> http://sourceforge.net/projects/o2sms/forums/forum/917641/topic/3671528 <br> http://blogs.gnome.org/muelli/2009/10/
From the config, this program knows whether to logon to the vodafone.ie, o2sms mkdir ~/.vodasms //for o2, mkdir ~/.o2sms cd .vodasms
vi config //add the following lines username yourmobile_no password yourpassword_to_www.vodafone.ie alias me yourmobile_no //for an alias 'me' alias name mobile_no //optional proxy option: http-proxy http://proxy.server.com:3128
chmod 600 config
Usage of vodasms on the CLI
vodasms mobile_recipient //type in message here //and here too. //and end the message with CTRL+D
Via Message -m
vodasms mobile_recipient -m “type in message here” //Using the above, txts can easily be scripted
Note: If the www.vodafone.ie website is changed, the above script may/maynot work. It should be possible to update the script/utility with apt-get update and apt-get upgrade. Sincere thanks to Mackers.
= Forward Emails via SMS Text Message = Using the above vodasms, we can have procmail forward a copy of the email by SMS Text Message. We also use “formail” which should be on most systems by default, to strip out only the bits of the email we require.
You must setup procmail to work. Read procmail for extra information on rules etc. :0 c * ^From: .*firstname.lastname@example.org | formail -x Subject: | vodasms your_mobile_no > /dev/null
Procmail & Vodasms Notes
- Its :0 c and not :0 c:. The : is to lock the file been processed. As there is no file and its just been piped to a command, there is no colon.
- formail is used in the above, to ONLY send the Subject of the email. Sending the body for example, which could have html tags in it would waste a lot of text messages.
- Multiple messages are used if need be.
- formail -X and -x. The capital X puts the title of the field in the messsage. E.g. -X Subject = “Subject: subject of email” rather than “subject of email”.
- formail -X From: would be nice, however it will put “<First Lastname> First.Lastname@server.com” wasting a lot of space. Also as the rule above only comes from 1 person, there is no need to show who its coming from.
- The > /dev/null is so that any errors or output from vodasms is ignored.
- Make sure that at the top of your procmailrc file you have the correct path if you compiled o2sms manually → PATH=/bin:/usr/bin:/usr/bin:/usr/local/bin/o2sms
= Updating vodasms/o2sms 2010 = So it appears that apt.mackers.com is gone and won't be coming back. Until I get the svn method working off sourceforge, a patch was required recently for o2sms. As on the o2sms forum ( http://sourceforge.net/projects/o2sms/forums/forum/917641/topic/3590078 ) a patch was available. wget http://www.mattb.net.nz/patches/o2sms/o2smsaction.diff #patch /usr/share/perl5/WWW/SMS/IE/o2sms.action -i /root/o2smsaction.diff -o /usr/share/perl5/WWW/SMS/IE/o2sms.action-new