[Techtalk] Mail tricks

Mary Gardiner linuxchix at puzzling.org
Thu Jan 3 08:03:48 EST 2002


On Wed, Jan 02, 2002 at 11:57:01AM -0900, Jennifer Davis wrote:
> Anyhow, regarding email tricks, I was just wondering, I was trying to
> write a script that takes ps files and converts them to pdf.  ps2pdf is
> great for that, as far as I can tell.  What I would like to do is show off
> OS software to my co workers by setting up some sort of thing that would
> receive postscript files by email, then run ps2pdf on them and email them
> back.  I haven't got a clue where to begin with this.  Is there any
> reference I should look at.  I use sendmail with slack 8.

I would consider using procmail for this, although sendmail may have
something internally that will also allow programs to be triggered based
on content.

The procmail program is designed to inspect the headers (and contents
if you tell it) and sort it into different mail folders, but it can also
pass messages to external scripts.

For example, in my .procmailrc, I have a filter that looks like:

:0
* ^From.*whatever at puzzling.org
| /home/mary/Scripts/AnyCoat.py GenFiles/Whatever

Which means "for any mail matching (in the headers) the regular
expression '^From.*whatever at puzzling.org' run the program
/home/mary/Scripts/AnyCoat.py GenFiles/Whatever

You need a procmail filter that can observe the MIME type of
attachments. Others may have suggestions, I'm running out of time :)

The manpages are procmail (the program), procmailex (examples of
procmail rules) and procmailrc (complete description of the format for
the rules).

-Mary

-- 
Mary Gardiner
<mary at puzzling.org>



More information about the Techtalk mailing list