Subj : ANNOUNCE: Mail::Procmail 1.00 is released To : All From : Johan Vromans Date : Wed Jan 17 2001 09:19 am From: JVromans@Squirrel.nl (Johan Vromans) Mail::Procmail version 1.00 has been uploaded to CPAN. http://www.cpan.org/authors/id/JV/Mail-Procmail-1.00.tar.gz Mail::Procmail is a Procmail-like facility for creating easy mail filters. procmail is a great mail filter program, but it has weird recipe format. It's pattern matching capabilities are basic and often insufficient. I wanted something flexible whereby I could filter my mail using the power of Perl. I've been considering to write a procmail replacement in Perl for a while, but it was Simon Cozen's Mail::Audit module, and his article in The Perl Journal #18, that set it off. I first started using Simon's great module, and then decided to write my own since I liked certain things to be done differently. And I couldn't wait for his updates. Mail::Procmail allows a piece of email to be logged, examined, delivered into a mailbox, filtered, resent elsewhere, rejected, and so on. It is designed to allow you to easily create filter programs to stick in a .forward or ..procmailrc file, or similar. For example: use Mail::Procmail; # Set up. Log everything up to log level 3. my $m_obj = pm_init ( loglevel => 3 ); # Pre-fetch some interesting headers. my $m_from = pm_gethdr("from"); my $m_to = pm_gethdr("to"); my $m_subject = pm_gethdr("subject"); # Default mailbox. my $default = "/var/spool/mail/".getpwuid($>); pm_log(1, "Mail from $m_from"); pm_ignore("Non-ASCII in subject") if $m_subject =~ /[\232-\355]{3}/; pm_resend("jojan") if $m_to =~ /jjk@/i; # Make sure I see these. pm_deliver($default, continue => 1) if $m_subject =~ /getopt(ions|(-|::)?long)/i; # And so on ... # Final delivery. pm_deliver($default); DIFFERENCES WITH MAIL::AUDIT Note that several changes are due to personal preferences and do not necessarily imply deficiencies in Mail::Audit. * General Not object oriented. Procmail functionality typically involves one single message. All (relevant) functions are exported. * Delivery Each of the delivery methods is able to continue (except pm_reject and pm_ignore). Each of the delivery methods is able to pretend they did it (for testing a new filter). No default file argument for mailbox delivery, since this is system dependent. Each of the delivery methods logs the line number in the calling program so one can deduce which 'rule' caused the delivery. Message IDs can be checked to suppress duplicate messages. System commands can be executed for their side-effects. pm_ignore logs a reason as well. pm_reject will fake a "No such user" status to the mail transfer agent. * Logging The logger function is exported as well. Logging is possible to a named file, STDOUT or STDERR. Since several deliveries can take place in parallel, logging is protected against concurrent access, and a timestamp/pid is included in log messages. A log reporting tool is included. * Robustness Exit with TEMPFAIL instead of die in case of problems. pm_pipe_to ignores SIGPIPE. pm_pipe_to returns the command exit status if continuation is selected. Commands and pipes can be protected against concurrent access using lockfiles. --- BBBS/LiI v4.01 Flag-2 * Origin: Prism bbs (1:2320/38) .