Example #1
0
File: Mail.php Project: Zed3/foodie
 function send_delivery($delivery)
 {
     $subject = "[Foodie] - {$delivery->rest_name}";
     $message = "<h3>המשלוח ממסעדת {$delivery->rest_name} סופק לחברה</h3>";
     $message .= "<hr/>";
     $message .= "Sent via <a href='" . DIR . "'>Foodie</a>";
     $mail = new \Helpers\PhpMailer\Mail();
     //	    $mail->SMTPDebug = 2;                               // Enable verbose debug output
     $mail->CharSet = 'UTF-8';
     $mail->isSMTP();
     // Set mailer to use SMTP
     $mail->Host = 'smtp.gmail.com';
     // Specify main and backup SMTP servers
     $mail->SMTPAuth = true;
     // Enable SMTP authentication
     $mail->Username = GMAIL_UN;
     $mail->Password = GMAIL_PASS;
     $mail->SMTPSecure = 'ssl';
     // Enable TLS encryption, `ssl` also accepted
     $mail->Port = 465;
     // TCP port to connect, tls=587, ssl=465
     $mail->From = GMAIL_UN;
     $mail->addAddress(GMAIL_MAIL_TO);
     $mail->subject($subject);
     $mail->body($message);
     $mail->FromName = 'Trusteer Foodie';
     $mail->WordWrap = 50;
     // Set word wrap to 50 characters
     $mail->isHTML(true);
     // Set email format to HTML
     $mail->AltBody = strip_tags($message);
     if (!$mail->send()) {
         echo 'Mailer Error: ' . $mail->ErrorInfo;
     }
 }