I am able to send an e-mail through SMTP and PHPMailer but I keep getting this error message.
Warning: Cannot modify header information - headers already sent by (output started at /home/admin/public_html/inc/phpmailer/class.smtp.php:181) in /home/admin/public_html/contact/index.php on line 79
After sending my e-mail I want to forward the user to a thank-you page. This is my php to do so.
if (($noName == false) AND ($noEmail == false) AND ($badEmail == false) AND ($noMessage == false)) {
header('Location: index.php?status=sent');
exit;
}
I am using the SMTP PHPMailer class to do so.
//Create a new PHPMailer instance
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
$mail->Host = "smtp.gmail.com";
$mail->Port = 465; // or 587
$mail->IsHTML(true);
$mail->Username = "******";
$mail->Password = "******";
Any suggestions as to why this is throwing this error message?