Advertisement
Guest User

Untitled

a guest
Aug 6th, 2017
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. //config part
  2. 'mailer' => array(
  3. 'transport' => 'smtp', //mail or smtp
  4. 'smtp_host' => "kidsandfamily-transactional.mms.kidsandfamily.west.mtvi.com", //hostname of smtp server
  5. 'smtp_port' => 25, //port to use
  6. 'smtp_auth' => false, //Wether or not to use smtp auth
  7. 'smtp_user' => null, //smtp auth username
  8. 'smtp_password' => null, //smtp auth password
  9. 'virtual_server_group' => 'kidsandfamily-transactional', //X-Virtual-Server-Group custom header
  10. ),
  11.  
  12.  
  13. /*
  14. Method: getMailer
  15. Obtain a PHPMailer object configured for transport in the current environment.
  16.  
  17. Parameter: none
  18.  
  19. Returns:
  20. PHPMailer object.
  21. */
  22. public static function getMailer()
  23. {
  24. include_once(CODEX_PATH.'/externals/PHPMailer/class.phpmailer.php');
  25. $mail = new PHPMailer();
  26. $mailer_config = HEAP::config('monkeyquest.mailer');
  27.  
  28. $mail->Mailer = $mailer_config['transport'];
  29. $mail->Host = $mailer_config['smtp_host'];
  30. $mail->Port = $mailer_config['smtp_port'];
  31. $mail->SMTPAuth = $mailer_config['smtp_auth'];
  32. $mail->Username = $mailer_config['smtp_username'];
  33. $mail->Password = $mailer_config['smtp_password'];
  34.  
  35. if($mailer_config['virtual_server_group'])
  36. $mail->AddCustomHeader('X-VirtualServerGroup: '.$mailer_config['virtual_server_group']);
  37.  
  38. $mail->CharSet = 'UTF-8';
  39.  
  40. return $mail;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement