vim sendmail.plhtml
#!/usr/bin/perl -wshell
use MIME::Lite;vim
sub perl_sendmail {ide
my $mail_to="$_[0]"; 收件人郵箱htm
my $from = "$_[1]"; 發件人郵箱it
my $subject = "$_[2]"; 郵件標題class
my $data = "$_[3]"; 郵件內容perl
$sendmail = MIME::Lite->new(權限
From => $from,im
To => $mail_to,
Subject => $subject,
Data => $data
);
$sendmail->attr("content-type" => "text/html");
$sendmail->send;
}
perl_sendmail(@ARGV);
給上邊perl腳本執行權限就能夠經過shell腳本調用上邊的perl腳本了
./sendmail.pl "收件人郵箱地址" "發件人郵箱地址" "郵件標題" "郵件內容"