Sean O'Leary on Fri, 2 Feb 2001 11:49:12 -0500 (EST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Mail Server


At 11:28 AM 02/02/2001, you wrote:
        Looking for the simplest way to send email from
a Perl script on a Windows box. Any suggestions?

        PHP makes it real easy, just configure a SMTP mail
server in php.ini.

Urb

Use Net::SMTP. Real easy to follow man page for it, too.

Below is a bit of a cookbook for it, assign sensible values to the UPPERCASED variables.

my $smtp = Net::SMTP->new($MAIL_SERVER,
# Debug => 1, # <- Uncomment to see debugging # info for mail connection.
);
# Set the sender, then recipient, then send the message, then close the
# connection.


$smtp->mail($MAIL_SENDER);
$smtp->to(@MAIL_RECIPIENTS);
$smtp->data(@MESSAGE);
$smtp->quit();

@MESSAGE is an array of lines that will be the message. You might want to use some sort of formatter to make the email look pretty. (Text::Autoformat comes to mind.)

I can't believe that Robert beat me to the punch on the File::Find thread. I hope this one gets out before his reply to Uri's note comes in. : )

Later,

Sean.

**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**