电子邮件发送正确,但是我提交页面上的所有内容都消失了(尽管在url中说是同一页面),但回声语句说“消息已成功发送”。
在向他们发送验证电子邮件后,我希望有一个“祝贺”页面或较不俗气的方式向用户打招呼...
我尝试在class.phpmailer.php中搜索重定向功能,但没有任何帮助。我敢肯定它很简单,但是我似乎无法找到导致此问题的原因。
<?php
require ('/config.inc.php');
require '../PHPMailer/PHPMailerAutoload.php';
if(mysqli_affected_rows($dbc) == 1){
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPSecure = 'ssl';
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->Username = "[email protected]";
$mail->Password = "censored";
//Set who the message is to be sent from
$mail->setFrom('[email protected]');
//Set an alternative reply-to address
$mail->addReplyTo('[email protected]');
//Set who the message is to be sent to
$mail->addAddress($trimmed['email']);
//Set the subject line
$mail->Subject = 'PHPMailer mail() test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML('Thank you for registering at The Circle Of Pi. To activate your account,
please click on this link:\n\n' . BASE_URL . 'activate.php?x=' . urlencode($e) . "&y=$a");
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
//$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!1";
}
exit();
}else {
echo '<p class=\"error\">You could not be registered due to a system error. We apologize
for any inconvenience.</p>';
}
}else{
echo '<p class = \"error\">That email address has already been registered. If you have
forgotten your password, use the link at the right to have your password sent to you</p>';
}
} else {
echo '<p class = \"error\">Please try again.</p>';
}
mysqli_close($dbc);
}
?>
如果您的请求是,POST
则exit()
在“消息已发送!1”回显后致电。
else {
echo "Message sent!1";
}
exit();
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句