我遇到了PHPmailer卡在我的mail.php屏幕上的问题(通常它会将用户转发到success.html页面)。我已经开启了错误报告,但仍然没有显示任何内容。我在PHP上相当不错,但在我将测试URL移动到我想要的实际URL之前(我的服务器上只有几个目录),它正在处理我的测试URL。现在我被困在白色屏幕上,没有任何错误。
另外,我有一个问题,在hotmail上(也许还有其他一些提供商 - Gmail现在正常运作)它将电子邮件标记为垃圾邮件。我修复了反向DNS问题,但它仍然将电子邮件标记为垃圾邮件。关于如何修复它的任何想法?请检查我的身体,看看内容是否会引起任何危险信号。
以下是代码:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once('/var/www/includes/PHPMailer/PHPMailerAutoload.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
//gather variables from form//
$gmname = $_POST['gmname'];
$charname = $_POST['charname'];
$email = $_POST['email'];
$date = $_POST['date'];
$time = $_POST['time'];
$bantype = $_POST['radiogroup'];
$banreason = $_POST['banreason'];
//end gather//
$mail = new PHPMailer();
$mail->CharSet = 'UTF-8';
$body ="Attention account holder,<br \>This is a notice informing you that your Ashran account has been suspended. Please review the following information.<br \><br \>Account Name: $email<br \>Character Name: $charname<br \>Server: US - Grommash<br \>Ban Reason: $banreason<br \>Ban Type: $bantype<br \>Ban End Date: $date $time Server Time<br \>Banning staff member: $gmname<br \><br \>If you would like to appeal your ban because you feel that you were incorrectly punished, please follow the instructions in the following thread: <a href="http://forum.ashran.com/index.php?/topic/9461-ban-appeals/#entry68417">Click Here</a><br \><br \>Do NOT reply to this email.";
//$body = eregi_replace("[\]",'',$body);//
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->SMTPDebug = 1; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "tls"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 587; // set the SMTP port for the GMAIL server
$mail->Username = "----------@gmail.com"; // GMAIL username
$mail->Password = "----------"; // GMAIL password
$mail->SetFrom('----------@gmail.com', '------ -----');
$mail->AddReplyTo("---------@gmail.com","----- -----");
$mail->Subject = "Ashran - Account Suspension Notice";
//$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$address = "$email";
$mail->AddAddress($address);
//Sets URL for forward after completion
$url = 'success.html';
//
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
header( "Location: $url" );
echo "Ban notice sent!!!";
}
&GT;
答案 0 :(得分:0)
对于垃圾邮件文件夹问题:如果您发现自己正在调整内容,然后检查是否修复了投放问题,则可以使用inboxtrail.com的种子基于电子邮件的可传递性测试,以查看在每次内容更改后哪些电子邮件提供商将您转储到垃圾邮件文件夹。重新测试所有顶级提供商可能是一个好主意,因为对于所有你知道解决hotmail问题的内容更改可能会在gmail或yahoo等上产生新问题。这还应该告诉您电子邮件服务器的配置方式是否设置了任何红色标记。