Пример #1
0
 private function _sendVerificationEmail($agent, $code, $attachment = null)
 {
     date_default_timezone_set('Etc/UTC');
     $mail = new PHPMailer();
     //Tell PHPMailer to use SMTP
     $mail->isSMTP();
     $mail->SMTPDebug = 0;
     $mail->Debugoutput = 'html';
     $mail->isHTML(true);
     $mail->Host = SMTP_HOST;
     $mail->Port = SMTP_PORT;
     $mail->SMTPSecure = 'tls';
     $mail->SMTPAuth = true;
     $mail->Username = SMTP_EMAIL_ACCOUNT;
     $mail->Password = SMTP_PASSORD;
     //Set who the message is to be sent from
     $mail->setFrom('*****@*****.**', 'Obaro Isreal');
     $mail->addReplyTo('*****@*****.**', 'Obaro Isreal');
     $mail->addAddress($agent->email, $agent->firstname . " " . $agent->lastname);
     if ($attachment != null && file_exists($attachment)) {
         $mail->addAttachment($attachment, "Your Barcode");
     }
     $mail->Subject = 'Welcome to flights.com[verification send]';
     //add the html contents
     $message = " <h2>Account Details</h2> <br>Dear " . $agent->lastname . ",<br> " . "<p style='text-indent: 30px;'> Welcome to flights below is your account informations : <br>" . " Username : {$agent->email} <br> Password: {$agent->password}<br>" . " Verification Code : {$code}" . "<hr> Click on the below link to verify your account " . ContextManager::CreateLink("Verify my Account", "Agent", "Confirmation") . "</p> <br> or copy and paste on the browser  this URL  " . HOST_NAME . "?url=Agent&action=VerifyUser&code={$code} <hr>" . "<br>" . " <p>Alternatively scan the barcode with your phone or any device to quickly verified your email,, the barcode image is attached with this message</p> ";
     $mail->msgHTML($message);
     $status = $mail->send();
     return $status;
 }