On 2007-06-01, Bennett wrote:
> I have a perl script on a low-powered machine and I want to send mail
> from the machine by relaying the outgoing mail through a remote SMTP
> server (that I've paid for, of course, not an open relay :) ).
> I've tried searching for things like "perl" "use a smarthost" but I've
> been unable to find anything relevant. Are there any code samples
> showing how to do this?
If your requirements are simple, you can probably use the Mail::Mailer
module. According to the man page, you can
Use the "smtp" protocol via Net::SMTP to deliver the mail. The
server to use can be specified in @args with
$mailer = new Mail::Mailer smtp, Server => $server;
The smtp mailer does not handle "Cc" and "Bcc" lines, neither their
"Resent-*" fellows. The "Debug" options enables debugging output
from "Net::SMTP".
You may also use the "Auth => [ $user, $password ]" option for SASL
authentication (requires Authen::SASL and MIME::Base64).
HTH.