#!/usr/bin/perl -w

#usage mail2stmp smtp-host  address reply-to subject message
	   
use Net::SMTP;
use Net::Domain qw(hostname hostfqdn hostdomain);

$name= getpwuid ($<);
$sender = $name."\@".hostname().".".hostdomain();
print "mail2smtp Sender=".$sender."\t\t dest=".$ziel."\n";


$host = $ARGV[0];
$ziel     = $ARGV[1];
$reply    = $ARGV[2];
$subject  = $ARGV[3];
$message  = $ARGV[4];


$smtp = Net::SMTP->new($host,
		      Debug => 1);
print $smtp->domain,"\n";  

$smtp->mail($sender);
$smtp->to($ziel);

$smtp->data();
$smtp->datasend("Reply-To: ".$reply."\n");
$smtp->datasend("To: ".$ziel."\n");
$smtp->datasend("Subject: ".$subject."\n");
$smtp->datasend("\n");
$smtp->datasend($message);
$smtp->dataend();

$smtp->quit;
 
