On Fri, 29 Aug 2003, Jason Stubbs wrote:

> Me and my girlfriend have one computer - a laptop. I want to use it 24/7, she
> wants to use it just to check mail every so often. So, what I want to do is
> have procmail send details of any new messages that aren't spam to my
> girlfriend's mobile. That is, not the whole message, only the date/time,
> sender and subject - maybe a couple of lines like Spam-Assassin does for
> spam-mail as well.
>
> My guess is that it is not directly possible with procmail. I'm guessing that
> I'd have to use some sort of script to pipe each e-mail message through. Any
> suggestions on how I could write such a script?

I don't have procmail on this computer, but I think I can give a rough
idea of what to do.  First, read the procmail man page about the flags.
You'll want to clone the message and process only the header.  If it's to
your girlfriend and not spam (with negative regexp for spamassassin header
line), then filter it.  The following script should work, though you
should doublecheck, as I haven't dealt much with multiline strings and
I've never sent mail from a perl script before.

#!/usr/bin/perl
$myemail = "";
$notify_subject = "New mail!";
$header = /^(From|Date|Subject)/;
open MAIL,"|mail -s $notify_subject $myemail";
print MAIL $header;
close MAIL;

Adapt to your own desires and needs.  :)

-- 
Caution: Product will be hot after heating


--
[EMAIL PROTECTED] mailing list

Reply via email to