使用perl的Mail::SendEasy模塊來發送郵件,首先須要肯定已安裝Mail::SendEasy模塊ide
- #! /usr/bin/perl -w
- use strict;
- print "mail to start............/n";
- use Mail::SendEasy;
- my $mail = new Mail::SendEasy(
- smtp => 'smtp.qq.com',
- user => '51cto@qq.com',
- pass => "51cto",
- );
- my $status = $mail->send(
- from => '51cto@qq.com',
- from_title => 'qq mail',
- to => 'admin@qq.com',
- subject => "$ARGV[0]",
- msg => "$ARGV[1]",
- );
- if (!$status) {
- print $mail->error;
- }