Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. <?php defined('BOOT_PATH') or die('No direct script access.');
  2. /**
  3. * @author Mikael Laforge <mikael.laforge@gmail.com>
  4. * @version 1.1.0
  5. * @package Nex
  6. * @subpackage core
  7. * @copyright Copyright (c) 2012
  8. *
  9. * @update (12/12/2011) [Mikael Laforge] 1.0 - Script creation
  10. * @update (15/10/2013) [ML] 1.0.1 - Now support more configs, for SMTP
  11. * @update (29/03/2016) [DM] 1.1.0 - Updated to match latest version of PHPMailer (5.x)
  12. *
  13. * @todo should uses drivers
  14. *
  15. * This class is used to wrap the external librairie PHPMailer
  16. */
  17.  
  18. include(EXT_PATH . 'php' . DIRECTORY_SEPARATOR . 'PHPMailer' . DIRECTORY_SEPARATOR . 'class.phpmailer.php');
  19. require_once(EXT_PATH . 'php' . DIRECTORY_SEPARATOR . 'PHPMailer' . DIRECTORY_SEPARATOR . 'class.smtp.php');
  20.  
  21. class Itremma_Nex_App_Mailer extends PHPMailer
  22. {
  23. /**
  24. * Constructor
  25. * @param boolean $exceptions Should we throw external exceptions?
  26. */
  27. public function __construct($exceptions = false)
  28. {
  29. parent::__construct($exceptions);
  30. $mail = Nex::config('mail');
  31.  
  32. // Set defaults
  33. $this->CharSet = 'UTF-8';
  34. $this->WordWrap = 50;
  35. $this->From = Nex::config('mail._default.from');
  36. $this->FromName = Nex::config('mail._default.from_name');
  37.  
  38. $config = Nex::config('mailer');
  39. if ($config) {
  40. $this->Mailer = $config['method'];
  41.  
  42. if ($this->Mailer == 'smtp') {
  43. $this->Host = $config['host'];
  44. $this->Port = $config['port'];
  45. $this->Username = $config['user'];
  46. $this->Password = $config['password'];
  47. $this->SMTPSecure = $config['secure_protocol'];
  48.  
  49. if ($this->Username) {
  50. $this->SMTPAuth = true;
  51. }
  52. }
  53. }
  54.  
  55. // Adding BCCs
  56. ($bcc = Nex::config('mail.debug')) && Nex::config('system.debug.email') && $this->addBccList(explode(';', $bcc));
  57. }
  58.  
  59. public function addBccList($list)
  60. {
  61. foreach ($list as $item) {
  62. $this->addBcc($item);
  63. }
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement