[Mailman-Users] Email Header

Sinan Kaan Yerli sinan at sinan.physics.metu.edu.tr
Wed Jun 5 10:22:27 CEST 2002


(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    => 'ournewsletter at foo.com',
>         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 <sinan at skyerli.org>





More information about the Mailman-Users mailing list