使用perl的Mail::SendEasy模块来发送邮件,首先需要确定已安装Mail::SendEasy模块

 
  
  1. #! /usr/bin/perl -w 
  2.  
  3. use strict; 
  4. print "mail to start............/n"; 
  5. use Mail::SendEasy; 
  6. my $mail = new Mail::SendEasy( 
  7.          smtp => 'smtp.qq.com', 
  8.          user => '51cto@qq.com', 
  9.          pass => "51cto", 
  10.          ); 
  11.  
  12. my $status = $mail->send( 
  13.          from => '51cto@qq.com', 
  14.          from_title => 'qq mail', 
  15.          to => 'admin@qq.com', 
  16.          subject => "$ARGV[0]", 
  17.          msg => "$ARGV[1]", 
  18.          ); 
  19. if (!$status) { 
  20.      print $mail->error;