Using SMTP Mailers - Sample Code PHPMailerPosted by Dave Zulu on 17 August 2018 01:41 PM |
|
//<?PHP use PHPMailer\PHPMailer\PHPMailer; error_reporting(E_STRICT | E_ALL); if ($_POST['pageBody']!='') { date_default_timezone_set('Etc/UTC'); //require_once 'PHPMailerAutoload.php'; $results_messages = array(); $t = time(); $s = md5($t); echo($t . "<br>"); echo($s); $mail = new PHPMailer(true); $mail->CharSet = 'utf-8'; $mail->isSMTP(); $mail->SMTPDebug = 2; //Ask for HTML-friendly debug output $mail->Debugoutput = 'html'; //Set the Connection details of the mail server /* Set the hostname of the mail server will be either: - monitoring.zululabs.com or - pmta.zululabs.com You do not require TLS/SSL as you are a trusted host the relay is configured to handle delivery to mail servers using TLS and will open a TLS connection with the initiating server if your server is capable but do not set $mail->SMTPSecure Set the SMTP port to 25 */ $mail->Host = "pmta.zululabs.com"; $mail->Port = 25; // You must use Authentication //Whether to use SMTP authentication // Username / Password - www.zuluedm.com you get yours or // log into your Zulu account and request details // It is important to set the AUTH Type to plain. $mail->AuthType = 'PLAIN'; $mail->SMTPAuth = true; $mail->SMTPAutoTLS = false; $mail->Username = ""; $mail->Password = ""; $mail->SMTPKeepAlive = true; // //Same body for all messages, so set this before the sending loop //If you generate a different body for each recipient (e.g. you're using a templating system), //set it inside the loop // $mail->msgHTML(file_get_contents('TouchingBaseutf8.html'), dirname(__FILE__)); //$mail->msgHTML($body); //msgHTML also sets AltBody, but if you want a custom one, set it afterwards //$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; //Connect to the database and select the recipients from your mailing list that have not yet been sent to //You'll need to alter this to match your database | |
|
Comments (0)
Copyright Zulu Labs Global Pty Ltd, 297 Dorcas Street South Melbourne VIC, Australia 3205. Ph +61 3 9001 1590