2013年4月2日星期二
A really good mail script written in php
# Download the script
cd /bin
wget http://www.myciscolab.net/sources/phpmailer.txt
wget http://www.myciscolab.net/sources/class.smtp.txt
mv phpmailer.txt phpmail
mv class.smtp.txt class.smtp.php
chmod a+x phpmail
# Modify /bin/phpmail
if ( $argv[1] == null || $argv[2] == null || $argv[3]== null ){
echo "Usage: phpmail <aaa@bbb.com> <subject> <body> [attachment]";
echo "\n";
exit;
}
$mail = new PHPMailer();
$mail-> IsSMTP();
$mail->Host = "smtp.exmail.qq.com";
$mail->SMTPAuth = true;
$mail->Username = "aaa@bbb.com";
$mail->Password = "aaa";
$mail->From = "aaa@bbb.com";
$mail->FromName = "aaa";
$mail->AddAddress($argv[1]);
$mail->WordWrap = 50;
if ( $argv[4] == null ) {
$mail->AddAttachment("");
}
else {
$mail->AddAttachment($argv[4]);
}
$mail->IsHTML(true);
$mail->Subject = $argv[2];
$mail->Body = $argv[3];
if(!$mail->Send())
{
echo "Messages could not be send.\n";
echo "Mailer Error:" . $mail->ErrorInfo ."\n";
exit;
}
echo "Message has been sent";
echo "\n";
# Usage
phpmail <aaa@bbb.com> <subject> <body> [attachment]
订阅:
博文评论 (Atom)
没有评论:
发表评论