我将我的邮件方法从我的表单升级到phpmailer,第一个问题是:
这就是我需要的代码吗? (它似乎确实有效)不确定我是否应该使用SMTP。
require_once('PHPMailer-master/class.phpmailer.php');
$mail = new PHPMailer(); // defaults to using php "mail()"
$body = $display;
//$mail->AddReplyTo("name@yourdomain.com","First Last");
$mail->FromName = 'UMVA Membership Form';
$mail->Host = 'www.umvaonline.org';
$mail->AddAddress('matthew_stacey@ymail.com', "Matt Stacey");
$mail->AddAddress('jskippy@roadrunner.com', "Jacqueline Bennett");
if ($fname2 !="") {$mail->Subject = "UMVA Membership Update ". $fname . " and " . $fname2 . " " . $lname;}
else {$mail->Subject = "UMVA Membership Update " . $fname . " " . $lname;}
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Your info has been submitted!<br /><br />";
}
第二个问题:电子邮件是我自己和表格中的另一个人。如何将ReplyTo设置为NONE或No Reply?由于消息来自root用户并且服务器上没有电子邮件帐户,所以没有人可以回复。谢谢!