Mail

Perl can't send mail with Blat.

Chances are, there's nothing wrong here, except that you need to enable the I/O redirection in the metabase.

What else can I use to send mail?

I hear that there's a CDONTS object for form mailers in the IIS4 Help, somewhere. I haven't used it myself, since I do it using Perl's Net::SMTP module. If you've got one of the more recent versions of ActiveState's distribution, I believe this will be installed already, since it's part of the libnet distribution. If not, you can get it from your nearest CPAN mirror. CPAN is the Comprehensive Perl Archive Network, reachable from www.perl.com.

Net::SMTP is fairly easy to use, providing you've got an SMTP mail server knocking around on your network, that you can use to handling routing and delivery. The client end of your script ends up looking something like this (I'm typing from memory here):

use Net::SMTP;
my $server = 'mailhost.example.com';
my $sender = 'webserver';
my $addr = 'webmaster';

my $msg = <<GROKTHIS;
From: $sender
To: $addr
Subject: Example

This is the example message.
GROKTHIS
my @msglines = split "\n", $msg;

my $smtp = Net::SMTP->new($server);
$smtp->mail($sender);
$smtp->to($addr);
$smtp->data(\@msglines);
$smtp->quit();
exit 0;

If you're interested in more complex things, CPAN has them too. There are modules for generating MIME messages, which you can use to mail files to people, and I've used to HTTP-post files to server scripts.


Steve Kilbane. Whitecrow home.