My phone is now an email notifier

If you send a mail to my “real” email address (not any of the ones I use for businesses and other non-people), it will now get sent to my mobile phone as an SMS. Unless it’s between 1AM and 8AM, then it won’t. Only the first few lines get sent, and it uses the sender’s email address as the sender for the SMS.

I use gmail to read all my mail these days, and I even have their mobile phone app on my phone, so in theory I can even reply from my phone. I set this up because GMail notifier on the Mac doesn’t work if the screensaver is active. Which is when I MOST want it to work. It’s really dumb. I could run Mail.app or some other pop mail program and let it notify me, but I don’t want to just on principle. I couldn’t find a simple pop notifier that worked with gmail.

Plus I figure it’ll be nice to get a notification of “real” email no matter where I am too. At least until I get tired of my phone beeping all the time. Before I switched to gmail, this would’ve been completely unreasonable, but gmail’s spam filter is excellent. I’m not worried about floods of spam making it to my phone.

Update: with a few more real world messages having passed through the system, something bizarre about my cell phone provider’s system emerged.  Any message that contains “href=” at all will not be forwarded to my phone.  “href” is fine, “foo=” is fine, URLs themselves are fine.  But  not “href=”.  So HTML email with links failed.  The fact that it was a spam that made it by GMail’s filter doesn’t mean I wasn’t annoyed that my system failed to work :).  I fixed it now, but I didn’t update the instructions.  That can’t possibly be true for everyone.  I just added a “| sed ‘s/href=/href:/'” into each procmail rule.

Read more for the full MacGyver details

fetchmail to get mail off my gmail account via POP (which thankfully doesn’t mark the mail read!)

procmail with these rules:

PHONE=[email to sms gateway address for my phone]
FROM_=`formail -rt -xTo: | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
SUBJ_=`formail -c -xSubject:
         | expand
         | sed -e 's/  */ /g'
         | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`

:0:
* ^TO_joe@rumsey.org
* ^Content-type:.*boundary.*
| formail -k -X Content-type: | stripmime | head -4 | timecheck mailsend -smtp smtp -t $PHONE -sub "$SUBJ_" -f "$FROM_"

:0:
* ^TO_joe@rumsey.org
| formail -I "" | head -4 | timecheck mailsend -smtp smtp -t $PHONE -sub "$SUBJ_" -f "$FROM_"

timecheck script:

#!/bin/bash
let hour=`date +%H`

if (($hour < 1 || $hour > 7)); then
	cmd=$1
	shift
	exec $cmd "$@"
fi

mailsend program
stripmime program

Now where’s my iPhone already? :(

1 Comment »

  1. Su Ishmael Said,

    November 20, 2013 @ 9:41 am

    Always put you profile infos before you make your surveys that pay . Any time a company conducts surveys with with different payment method

RSS feed for comments on this post · TrackBack URI

Leave a Comment