programming-examples/perl/Network/Send email out with SMTP.pl
2019-11-15 12:59:38 +01:00

24 lines
459 B
Perl

#!c:\perl\bin
use Net::SMTP;
print "Content-type: text/html \n\n";
$server = 'mail.mydomain.com';
$fromaddress = 'me@mydomain.com';
$toaddress = 'you@yourdomain.com';
$subject = "Test Example \n\n";
$message = "This is a test \n\n";
$smtp = Net::SMTP->new($server);
$smtp->mail($fromaddress);
$smtp->to($toaddress);
$smtp->data();
$smtp->datasend("Subject: $subject");
$smtp->datasend($message);
$smtp->dataend();
$smtp->quit();