我之前发布了电子邮件和搬迁问题,但是在尝试了几件事并进行了跟踪(在生产中!耶!)之后,我找到了罪魁祸首——但不知道为什么或从哪里去。
您将在下面的代码中看到我两次包含“email.php”-因为一张收据发给用户,另一张收据包含有关用户的一些元数据并用于支持...
如果我注释掉第二个包含,我的重定向工作,如果我把它留在里面,它会爆炸......通知电子邮件是有效的,并且是唯一不同的东西。
我不知所措
PHP 表单处理器
...
// send two emails
$_emailTo = $email; // the email of the person requesting
$_emailBody = $text_body; // the stock response with things filled in
include ( 'email.php' );
$_emailTo = $notifyEmail; // the support email address
$_emailBody = $pretext.$text_body; // pretext added as meta data for support w/ same txt sent to user
//I make it this far in my trace - then nothing
include ( 'email.php' );
// relocate
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=success.php" >';
exit;
PHP 邮件程序 (email.php)
<?php
require 'phpmailer/class.phpmailer.php';
//Create a new PHPMailer instance
$mail = new PHPMailer();
//Tell PHPMailer to use SMTP
$mail->IsSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 0;
//Set the hostname of the mail server
$mail->Host = "mail.validmailserver.com";
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 26;
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication
$mail->Username = "validusername";
//Password to use for SMTP authentication
$mail->Password = "pass1234";
//Set who the message is to be sent from
$mail->SetFrom('me@validmailserver.com', 'no-reply @ this domain');
//Set an alternative reply-to address
//$mail->AddReplyTo('no-reply@validmailserver.com','Support');
//Set who the message is to be sent to
$mail->AddAddress( $_emailTo );
$mail->Subject = $_emailSubject;
$mail->MsgHTML( $_emailBody );
$_emailError = false;
//Send the message, check for errors
if( !$mail -> Send() ) {
$_emailError = true;
echo "Mailer Error: " . $mail->ErrorInfo;
}
?>
请帮忙