你的分享就是我们的动力 ---﹥

Perl 使用 Net::SMTP 发送邮件

时间:2013-05-30 00:09来源:www.chengxuyuans.com 点击:

代码简介

暂无

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

转载注明地址:http://www.chengxuyuans.com/Perl/63121.html