I have a problem with the redirection after sending an Confirmation Email with PHPMailer
. The User doesn't get redirected to the memberIndex.php
.
I've tried with:
`$mail->Send();
header("Location:../memberIndex.php");
exit();`
Also turning off Debugging with:
`$mail->SMTPDebug = 0;`
And all combinations with ob_start/flush/clean
etc.
Note: When I left the body of the Mail ($mail->Body
) empty, it sends an email and redirects as it should. Otherwise, it stays on the registration page.
In the Body, I have some HTML-Tags and texts. Could it be, that the body blocks the redirection?
Here is my code where I build the email:
require '../../PHPMailer-master/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->SMTPDebug = 0;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'host'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'username'; // SMTP username
$mail->Password = 'password'; // SMTP password
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465; // TCP port to connect to
$mail->setFrom('info@test.com', 'test');
$mail->addAddress('test@test.com'); // Add a recipient
$mail->isHTML(true); // Set email format to HTML
$mail->AddEmbeddedImage('../img/text_dark.png', 'cs');
$mail->Subject = 'Hi Customer!';
$body = 'test';
$mail->Body = $body;
$mail->Send();
header("Location:../memberIndex.php");
exit();
?>