Email Notification via SMS in the US?
Joel McShiston asks: "Back in Europe I had set up a system through which urgent emails matching certain criteria were automatically forwarded upon arrival to a (free) email account which my cell phone carrier (Vodafone) provided for free with each account - {cell number}@vodafone.es. At the carrier's site I could then turn 'SMS notification of new email' on and would receive a text message telling me to check my email each time a matching email came through. I'll be soon moving to the US and would like to know whether any of you has a similar (or better) system working over there. Which kind of SMS-email 'interfacing' are you able to do on that side of the pond?"
echo '\'$USER', "|'$HOME/.do_sms_spawn'"' > ~/.forward
/%/g' | tr -d '\n') /dev/null 2>&1
cat >~/.do_sms_spawn.in <<EOF
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char **argv) {
chdir("HOME");
execlp("BASH", "bash", "HOME/.do_sms", NULL);
exit(1);
}
EOF
sed 's/HOME/'$HOME'/g;s/BASH/'`which bash`'/g' <~/.do_sms_spawn.in >~/.do_sms_spawn.c
cc ~/.do_sms_spawn.c -o ~/.do_sms_spawn
cat >~/.do_sms <<EOF
#!/bin/bash
do=0 #0=email,1=SMS
part=0 #0=headers,1=body,2=tagline
msg=
debug=n
exec >/dev/null 2>&1
debuglog=$HOME/sms-debug.log
while : ; do
read line || break
if [ "$debug" = "y" ] ; then echo $part$do $line >$debuglog ; fi
if [ $part -eq 0 -a "$line" = "" ] ; then
part=1
elif [ $part -eq 0 -a "$(echo $line|cut -c1-4)" = "To: " ] ; then
echo "$line" | fgrep "+sms@" >/dev/null 2>&1 && do=1
elif [ $part -eq 0 -a "$(echo $line|cut -c1-6)" = "From: " ] ; then
msg=$(echo $line|cut -c7-|cut -d\< -f2|cut -d\> -f1)
elif [ $part -eq 1 -a "$(echo $line|cut -c1-2)" = "--" ] ; then
part=2
elif [ $part -eq 1 -a $do -eq 1 ] ; then
msg="$msg $line"
fi
done
if [ $do -eq 1 ] ; then
msg=$(echo $msg|cut -c 1-160)
msg=$(echo -n "$msg" | od -t xC | cut -c8- | sed 's/
if [ "$debug" = "y" ] ; then echo msg: $msg >$debuglog ; fi
s='http://208.62.68.135/msgresult.shtml?min='`cat ~/.cellno`'&msg='
wget -q "$s$msg" -O
fi
EOF
chmod 700 ~/.do_sms
um=`umask`
umask 077
echo XXXXXXXXXX > ~/.cellno
umask $um
mail Hi there. | $USER'+sms@'$HOST
--TheOrangeSquid Is it any wonder things seem so awry? We swim in a sea of confusion and don't have to think to survive
So I simply went to that page, examined the form to see how it worked, and then wrote a simple little Perl script to do the same thing.
I can then invoke that Perl script from procmail to send me notices when I receive email I'm particularly interested in.