PugSA has asked for the wisdom of the Perl Monks concerning the following question:

Hi All

I've been trying to bounce mails from a Linux mailbox to a my outlook mail. Is there anything I need to setup on the mail for it to send as my code is not working I've set the mailhost in /etc/hosts

#!/usr/bin/perl use FindBin; use Mail::Box::Manager; my $scriptdir = $FindBin::Bin; my $mailspool = "/var/spool/mail/servicedesk"; my $mgr = Mail::Box::Manager->new; my $folder = $mgr->open(folder => "$mailspool", access => 'rw'); #my $msg = $folder->message(0); # $msg is a Mail::Message now # The message's subject foreach $msg ($folder->messages) { my $subject = $msg->subject; print "$subject\n"; $msg->bounce(To => "mymail@piet.co.za")->send or print "Failed +\n"; } ~

Thank you

Replies are listed 'Best First'.
Re: Mail Bounce
by pemungkah (Priest) on Aug 20, 2010 at 20:13 UTC
    Since you're resending from Linux, I'd really strongly suggest that you use procmail instead of writing your own solution (assuming you just want to get this done and move on).

    Procmail will allow you to do regex matches against your mail and other very sophisticated filtering/bouncing/whatnot.

Re: Mail Bounce
by Anonymous Monk on Aug 20, 2010 at 20:17 UTC