(04/06/2002 17:13) Doug La Farge:
>using .procmailrc:
>
>:0
>* ^To:.*newsletter
>* ^Subject:.*Newsletter
>| ./sendletter.pl
>
>Looking at sendletter.pl:
>
>#!/usr/bin/perl
>use Mail::Sendmail;
>
>while (<>){ $email .= $_ }
>$sql = "select email from users";
>#loop the SQL call
>%mail = ( To => "#emailaddress",
> From => '[EMAIL PROTECTED]',
> Subject => 'Our weekly news letter',
> Message => "$email"
>);
>sendmail(%mail) or die $Mail::Sendmail::error;
>#end the SQL call
>
>Some trickery is still require to strip out all the header info and
>just grab the body.
It can easily be done within the procmail recipe:
:0
* SELECTING RULES
{
:0 fBw
| sendletter.pl
# apply further rules to the MAIL e.g save to another mailbox
# or pipe/save into /dev/null
# ...
:0 a.....
...
}
The trick is the "B" switch: "f"ilter "B"ody and "w"ait.
--
Sinan Kaan Yerli <[EMAIL PROTECTED]>
------------------------------------------------------
Mailman-Users mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py