using a remote smarthost to send mail from a perl script

B

Bennett

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?
 
A

Adam Funk

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top