Dash Addresses
One of the features of Qmail is support for "dash addresses",
in other words an ordinary account name followed by a "-" and
some other word. I talked about this a bit in Mitel (E-Smith)
SME Server Mail Forwarding and Listsbut these have a use here
also.
The first thing to do is to arrange an account that we'll use
for this notification. I called it "notify". Just add a user
"notify" as you ordinarily would through the admin control panel.
Next, we're going to modify the user who gets the important
mail. We can do that either by having that user also forward
a copy to our "notify" user, or by turning that name into a
group that includes the real user and our "notify" user. In
either case, we then change "notify" so that its mail actually
gets forwarded to "notify-sms". You can do all this through
the normal administrative web panels; no "Unix" required yet.
Note also that we only created "notify", not "notify-sms".
Command Line Work
Now we do have to drop to the dreaded command line. In "notify"'s
home directory (cd ~notify) we need to create .qmail-sms for
the address "notify-sms" to work. In there we need just one
simple line:
 |
|
^ click above ^ |
That's a pipe symbol followed by the address of a simple Perl
program that handles the actual work:
Any mail sent to "notify-sms" goes to this program instead,
and nowhere else. This simple script extracts the Subject, Date,
and From lines and simply creates a new email message to one
or more recipents. Technically "Subject" lines can span multiple
lines; if you wanted to be sure to get all related lines this
would need to be more complex, but for this usage the first
would be all we'd want anyway.
That's it. This concept can be expanded to handle all sorts
of special mail handling tasks: junk mail filtering, special
automatic replies, etc.
Copyright
and Reprint Information
About the Author:
A.P. Lawrence provides SCO Unix and Linux consulting services
http://www.pcunix.com
|