SMS 1.06 - E-Mail notification reformatter

A tool for sending information on incoming e-mails.

This program is distributed under the terms of the GNU GPL (GENERAL PUBLIC LICENSE).

Copyright © 1998-9 by Robert Wagner <>

Any errors found in this documentation, comments or remarks are welcome - just drop me a mail. This document may contain information more topical than provided in the "readme" in So please refer to this page for latest documentation and information on SMS.

Disclaimer: You could cause immense trouble creating mail loops with this utility. So take care of any confirmation mails for SMS correctly transmitted. Also double-check whether your script always terminates and doesn't cause hundreds of running processes (Your admin won't find these things amusing at all...)

Consider yourself disclaimed!


Basic functionality.

Some nifty features - my all-singing, all-dancing SMS-notification tool :-)

Some important things...

Download (14.2 kB)


  1. Make sure the first line of the script points to your copy of Perl 5.

  2. Edit the Configuration Parameters at the start of the file, i.e. specify where your UNIX tools are located. The script needs the following UNIX tools: mail(1) (you might want to use Mail(1) or mailx(1) instead), head(1), wc(1) and formail(1) from the procmail(1) package. These tools should be available on every UNIX system.
    If you're unsure where these tools are located, you may check this out by executing the which(1) command. See which(1) for details.
    The mailtool is needed to determine how many mails are in your mailbox. Therefore it is important that it knows the -H option to return the mails' headers. If you're unsure whether your mailtool has got that feature, you may alternatively use the from(1) command for that purpose. For our needs, from does exactly the same as mail -H. See the code for a simple way of doing this.

  3. At the end of the script you'll have to choose one procedure for sending the information. I currently provide one for sending via MTN (send_string_mtn), Omnipoint (send_string_omnipoint) and Pagers or other electronics which can be reached by sending an e-mail (send_string_quix). Simply let the script use the appropriate procedure and comment out the other ones. Please mind that you'll have to do some minor configuring in 'your' procedure, i. e. inserting the right cellnet phone number for SMS or pager's e-mail address. Of course you may also implement you own sendmail or WWW dump routine for sending the string generated. This may either be a system call of your mailtool, giving it the string generated as parameter (in this case you can comment out the two lines for encoding), or a dump of the information into an WWW form. I'd advise you to utilize lynx for that purpose. If you write any other sending procedures, I'd be glad if you send them to me, so I can implement them into further distributions.

  4. Used files. There are some data files providing some user comfort. SMS writes all senders of mail it processed into the file specified in "$history". If there are some senders you do not want to be notified of, you can put their e-mail adresses in the file specified in "$killfile". If you do not want to be notified of mails sent to a particular address (in case you get mails sent to different e-mail addresses of yours on one account), write them in the file specified by "$quiet". "$mailbox" should indicate your mailbox file. Please note that all these three files have to exist, no matter if you use them or not, i. e. you have to create at least three empty text files and specify them in the script.

  5. The script contains features to send part of the mail body itself. However, it deletes the 'Hello Robert', or whatever greeting formula the mail contains. You therefore might want to replace [Rr]obert in the regex with your first name :-)

  6. Please study all the comments in the code carefully.

Oh yeah - I just wrote a "quick and dirty" tool providing killfile and history maintenance. It analyses the history and asks the user whether to put any of the names listed into the killfile, leave them in the history, or delete them. Of course it avoids multiple entries. I included it in distribution of "SMS".

Version history:
version 0.07 (97/06/17) written in ksh
version 0.42 (97/10/24) with additional perl code for separating sender's address
version 0.70 (98/01/09) re-written in perl
version 1.00 (98/01/09) basic running version
version 1.01 (98/01/10) minor modifications, tr(1) no more required
version 1.02 (98/01/15) bugfixes, slightly more elegant coding
version 1.05 (98/01/19) from as alternative for mailtool, inserted MTN SMS gateway example
version 1.06 (98/01/23) different sending methods implemented (MTN, Quix/via e-mail, Omnipoint)

© 1998 Robert Wagner,

SMS 1.06 - E-Mail notification reformatter. Copyright © 1998 Robert Wagner. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.