码迷,mamicode.com
首页 > Web开发 > 详细

PERL Net::SMTP

时间:2014-08-15 13:04:18      阅读:236      评论:0      收藏:0      [点我收藏+]

标签:os   ar   amp   new   on   ui   rom   user   


#!/usr/bin/perl -w


use strict;
use Net::SMTP;

my $to = ‘toMail‘;
my $from = ‘fromMail‘;
my $site = ‘mail.126.com‘;
my $smtp_host = ‘smtp.126.com‘;
my $pop_host = ‘pop3.126.com‘;
my $username = "userName";
my $password = "password";
    &writeAMesg;
sub writeAMesg{
    my $smtp = Net::SMTP->new( $smtp_host, Timeout=>60, Debug=>1 );
    $smtp->auth($username, $password);
    $smtp->mail( $from );
    $smtp->to( $to );
    $smtp->data();

    $smtp->datasend("To: $to\n");
    $smtp->datasend("Subject: A message from server\n");
    $smtp->datasend("\n");
    $smtp->datasend("This is just to let you know\n");
    $smtp->datasend("The flight is coming, Please check it out on time.\n");
    $smtp->datasend("\n");

    $smtp->dataend();
    $smtp->quit;
}



PERL Net::SMTP,布布扣,bubuko.com

PERL Net::SMTP

标签:os   ar   amp   new   on   ui   rom   user   

原文地址:http://my.oschina.net/u/347414/blog/301445

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!