<?php
/**
 * Created by PhpStorm.
 * User: roysinclair
 * Date: 2016/04/08
 * Time: 5:05 PM
 */

//20180601 - changed live to use Office360 Mailbox - pj

   // require ROOT.'/api/plugins/PHPMailer/PHPMailerAutoload.php';
   require_once('PHPMailer-5.2.28/PHPMailerAutoload.php');

   $mail = new PHPMailer;

//vd($_SERVER["SERVER_NAME"]);
   switch($_SERVER["SERVER_NAME"]){
      case "lamp":
         $mail->isSendMail();

         $mail->SMTPDebug = 1;
         $mail->Debugoutput = 'html';

         $mail->Host = "lamp";

         break;
      case "sabullion.co.za":
         $mail->isSMTP();                                      // Set mailer to use SMTP

         $mail->SMTPDebug = 0;
         $mail->Debugoutput = 'html';
                                        // Enable verbose debug output
         $mail->Host = 'sabullion.co.za';  // Specify main and backup SMTP servers
         $mail->SMTPAuth = true;                               // Enable SMTP authentication
         $mail->Username = 'business@sabullion.co.za';                 // SMTP username
         $mail->Password = "tC0BCb]23RW*";//'Nup83421';                           // SMTP password
         $mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
         $mail->Port = 587;                                    // TCP port to connect to
         $mail->SMTPKeepAlive = true;

         $mail->From = 'business@sabullion.co.za';
         $mail->FromName = 'SA Bullion Business';

         break;
   }


   $mail->addReplyTo("business@sabullion.co.za","SA Bullion business");
   $mail->setFrom('business@sabullion.co.za', 'SA Bullion Business');

   //additional smtp auths
   $mail->SMTPOptions = array(
      'ssl' => array(
         'verify_peer' => false,
         'verify_peer_name' => false,
         'allow_self_signed' => true
      )
   );
//}
