in reply to mail in script... how to add subject and from:
Also, check that whichever user is sending the mail is allowed to set the 'From:' field.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('sendmail'); }; 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: $!"; } } }
|
|---|