SMTPDebug = 2; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = $config_smtp_host; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = $config_smtp_username; // SMTP username
$mail->Password = $config_smtp_password; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = $config_smtp_port; // TCP port to connect to
//Recipients
$mail->setFrom($campaign_from_email, $campaign_from_name);
$mail->addAddress("$contact_email", "$contact_name"); // Add a recipient
// Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = "$campaign_subject";
$mail->Body = "Hello $contact_name,
$campaign_content
~
$company_name
$company_phone";
$mail->send();
mysqli_query($mysqli,"UPDATE campaign_messages SET message_sent_at = NOW() WHERE message_id = $message_id");
}catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
mysqli_query($mysqli,"UPDATE campaign_messages SET message_bounced_at = NOW() WHERE message_id = $message_id");
} //End Mail Try
}
mysqli_query($mysqli,"UPDATE campaigns SET campaign_status = 'Sent' WHERE campaign_id = $campaign_id");
}
} //End Company Loop through
?>