At 10:52 am -0400 13/9/04, Sherm Pendley wrote:

Ouch! That's very sendmail-specific, and you'll be in trouble if you need to switch to a different mailer. I'd suggest a mailer-agnostic approach using Mail::Sendmail. (It's name is derived from what it does - i.e. it sends mail - rather than the name of a specific mailer.)

Or even more generic and accessible Net::SMTP

#!/usr/local/bin/perl -w
use Net::SMTP;
my $debug=1;
if ($debug) {
  $| = 1;
  open( STDERR, qq~>&STDOUT~ );
}
$smtp = Net::SMTP->new('localhost', Debug => $debug);
# or ISP's SMTP host instead of localhost
$smtp->mail('[EMAIL PROTECTED]');
$smtp->to('[EMAIL PROTECTED]');
$smtp->data();
$smtp->datasend("To: [EMAIL PROTECTED]");
$smtp->datasend("Subject: test\n");
$smtp->datasend("\n");
$smtp->datasend("A simple test message\n");
$smtp->dataend();
$smtp->quit;

# JD



Reply via email to