Results 1 to 7 of 7
  1.    #1  
    Well, I didn't want to pay for anything. I knew that I could figure out some simple way to do alerts on my Treo 300 via SMS.

    I wanted something simple that I could turn on and off quickly. I decided that with just a unix shell account, procmail, and a simple unix shell script (could do it in perl as well) this could be done quite easily.

    I decided that I wanted to use a trigger file type setup to decide to send a sms alert to me or not. So if i'm at home or work I can turn it off, and not get annoyed by getting alerts of emails that are right in front of me. Also this way I could create a simple web "control panel" to load up in blazer and turn it on/off remotely as well.

    With the following procmail code it checks to see if a file called ~/.status is there. If it is, it'll send an alert. If it isn't, it won't.

    :0c: sms.lock
    * ? /bin/test -f /home/real-ity/.status
    | /home/real-ity/Procmail/sms
    Simple enough.

    Then I wanted to make the "sms" script that would put the subject, the sender, and the body respectively in variables. Then here I can truncate the msg to as long as I want, and send it to my sms email address.

    cat - > $tmp
    export from=`cat $tmp | formail -X From:`
    export subject=`cat $tmp | formail -X Subject:`
    export body=`cat $tmp | formail -I ""`
    echo "*Email Alert*" > $tmp2
    echo $from >> $tmp2
    echo $subject >> $tmp2
    echo $body >> $tmp2
    cat $tmp2 | head -5 | mail
    TaDa. It uses the formail utility that comes with procmail to parse each email and get the 3 fields that we want in the message. This would probably be a bit more powerful and more features if I did it in perl, but I felt like doing a shell script hehe.

    Anyone else have any non-service ideas that would give additions to our beloved treos?
    Gabe Kangas
    Achievatron 2004 - ?
    Visor Deluxe -> Treo 300 -> TREO 600 -> Treo 650
  2. #2  
    Sorry, I'm not very familiar with procmail.
    I'd like to implement this, and I have some questions.

    1) I place the first code snippet in a file,
    but what do I name the file.
    2) Must I invoke procmail -m [filename]?
    3) Does the sms script need to be executable?

    Thanks for offering up this neat solution.
  3.    #3  
    Hey there! Glad to see someone took interest in my solution

    Depending on your mta (mail transfer agent) you'd invoke procmail differently. There are some great procmail faqs and how-tos out there, and when I get off the train i'll post the urls to some hehe.

    Most likely you'll put the first section of code into the .procmail file in your home directory. You could also take a modular approach and put it in a rc.sms file and have the .procmail file load thqt. Different procmail tutorials reccomend different ways.

    For the sms shell script it should be set executable and run by bash to be safe. Not sure how other shells will treat it hehe.

    I'll post my .procmail file when I get home tonight and point out some sites of interest.
  4. #4  
    You're out late there. How nice it is to still be able to communicate with the Treo while travelling.

    Not too concerned about using the modular approach.

    Just want to get it running properly.
  5. #5  
    Well, I just ran the sms script and it sent a mail to my phone.
    Neat. Just gotta get it working with incoming mail now
  6. #6  
    Looks like I got it working! Excellent.
  7.    #7  
    How to setup your MTA with procmail

    Depending if you use sendmail, or qmail, or whatever you may or may not need to configure a .forward or .qmail file. My .qmail file is:

    |preline /usr/local/bin/procmail

    That's it for that file. Just tells your mta to run that mail that is coming in through a program and the program is procmail.

    Setting up your .procmail file

    This is where you set all your original variables and invoke any recipies. Mine is as follows:

    DEFAULT=$HOME/Mailbox #your mail file
    MAILDIR=$HOME/mail # Make sure this directory exists!

    And that procmail code I put in the first post is in the file rc.sms.

    Of course your default mailbox and the rest may differ for your setup, so make sure you get em right. The web page above shows some ways to test your setup once you get the files made. If you have any doubts what's going on, check out the log file you specified in the LOGFILE variable, if it's hitting the sms recepie it should show something like:
    From Wed Dec 11 07:38:12 2002
    Subject: COMDEX Marketplace: Smart Cards Show Strengths, Managing Remote
    Folder: /home/real-ity/Mailbox

    And that folder line is where the mail is being delivered to.. it should match your default mailbox.

    Let me know if you have any other questions, this is just a quick overview, but there are plenty of documents to check out including the one I linked to here.

    Let me know how things are going!

    Gabe Kangas
    Achievatron 2004 - ?
    Visor Deluxe -> Treo 300 -> TREO 600 -> Treo 650

Posting Permissions