Perl 使用 Net::SMTP 发送邮件

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#!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();