kilinrax has asked for the wisdom of the Perl Monks concerning the following question:
Which works fine. However, attempting to do this with Mail::Mailer, results in the mail appearing to come from www-data.sendmail ('god@heaven.com', 'die.puny@earthling.net', 'Test', 'This is + a test'); sub sendmail { my ($from, $to, $subject, $body) = @_; open(MAIL, "|/usr/lib/sendmail -oem -t -oi -f $from"); print MAIL "To: $to\n"; print MAIL "Subject: $subject\n\n"; print MAIL "$body\n"; close MAIL; }
I've read all the documentation I've been able to lay my hands on (Mail::Mailer's is rather minimal), and done a Super Search, but all to no avail.sendmail ('god@heaven.com', 'die.puny@earthling.net', 'Test', 'This is + a test'); sub sendmail { my ($from, $to, $subject, $body) = @_; my $mailer; eval { $mailer = Mail::Mailer->new(); }; if ($@) { warn "Couldn't send mail: $@"; } else { $mailer->open({ From => $from, To => $to, Subject => $subject }); print $mailer $body; unless (close ($mailer)) { warn "Couldn't close mailer: $!"; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(crazyinsomniac) Re: Changing the 'From:' header with Mail::Mailer
by crazyinsomniac (Prior) on Sep 14, 2000 at 22:15 UTC | |
by kilinrax (Deacon) on Sep 14, 2000 at 22:51 UTC | |
|
Re: Changing the 'From:' header with Mail::Mailer
by merlyn (Sage) on Sep 14, 2000 at 23:13 UTC |