On Friday 29 August 2003 21:13, Marshal Newrock wrote:
> 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.

Hmmm, I don't understand your script at all! But that's only because I don't 
know Perl. :-( That's alright though, coz I've got something that works. His 
a little bash script that does what I want:

#!/bin/sh
cat /dev/stdin > tmp1
grep Date: tmp1 > tmp2
grep From: tmp1 >> tmp2
grep Subject: tmp1 >> tmp2
cat tmp2 | mail -s "Mail Notification" [EMAIL PROTECTED]
cat tmp1

The only problem with it is if two messages are being processed at the same 
time. And to put in the correct mail address... Anybody know how I can create 
a unique temp file from bash?

Regards,
Jason

--
[EMAIL PROTECTED] mailing list

Reply via email to