programming-examples/perl/Network/Send mail.pl
2019-11-15 12:59:38 +01:00

21 lines
499 B
Perl

use Net::SMTP;
print "Content-type:text/html\n\n";
my $relay="relay.demo.net";
my $smtp="Net::SMTP->new($relay);
die "Could not open connection: $!" if (! defined $smtp);
$smtp->mail("Bate");
$smtp->to("admin@demo.net");
$smtp->data();
$smtp->datasend("To: admin@demo.net\n");
$smtp->datasend("From: admin@demo.net\n");
$smtp->datasend("Subject: Test1");
$smtp->datasend("\n");
$smtp->datasend("This is a test ...\n");
$smtp->dataend();
$smtp->quit;
print "Completed ...\n";