smtp.pl

#!/usr/bin/perl -w

use Mail::Mailer;

$smtp = Mail::Mailer->new("smtp","Server","smtp.server");

print "To:       ";
$to = ;
chomp($to);
print "Subject:  ";
$subject = ;
chomp($subject);
print "Body:n";

while ($line = ) {
    last if $line eq ".n";
    $body .= $line;
}

chomp($body);

print "Opening SMTP connection...n";
$smtp->open({
    "From" => "hmm@woolgathering.cx",
    "To" => $to,
    "Subject" => $subject
        });
print $smtp $body;
print "Sending email...n";
$smtp->close() or die "Can\'t close mailer: $!";
print "Mail sent.\n";