PHP Mailer 500内部服务器错误,但无论如何发送邮件

时间:2017-11-20 21:22:17

标签: php email server phpmailer internal

我正在尝试使用PHPMailer但是我收到了500个内部服务器错误,但奇怪的是我仍然收到了收件箱中的邮件。这是我正在使用的代码(出于安全原因,我的密码为明星)

    <?php
require 'PHPMailerAutoload.php';

$name = htmlspecialchars($_POST['name']);
$subject = htmlspecialchars($_POST['subject']);
$txt = $_POST['content'];
$email = strtolower($_POST['email']);

$mail = new PHPMailer;

//$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com';  // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = 'wo***oom@gmail.com';                 // SMTP username
$mail->Password = '***';                           // SMTP password
$mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465;                                    // TCP port to connect to

$mail->setFrom($email, 'Mailer');
$mail->addAddress('wo***oom@gmail.com');     // Add a recipient

$mail->isHTML(true);                                  // Set email format to HTML

$mail->Subject = $subject;
$mail->Body    = 'Email van: <b>'. $name .'</b>.<br> Bericht:<br>'. $txt .'';
$mail->AltBody = 'Email van: '. $name .'. Bericht: '. $txt .'';

if(!$mail->send()) {
    echo 'Bericht is niet verstuurd.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    header("contact.php");
}
header("contact.php");
?>

我在收件箱中收到包含正确标题,内容和发件人的邮件,但错误仍然存​​在

0 个答案:

没有答案