@@ -62,7 +62,7 @@ |
||
| 62 | 62 | * @param array $attachments |
| 63 | 63 | * @param string $mail_type |
| 64 | 64 | */ |
| 65 | - abstract public function getMessage(array $to, $from_email, $from_name, $subject, $message_body, array $attachments, $mail_type='html'); |
|
| 65 | + abstract public function getMessage(array $to, $from_email, $from_name, $subject, $message_body, array $attachments, $mail_type = 'html'); |
|
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * Wrapper to send the message |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | public function __construct($config = array()) |
| 35 | 35 | { |
| 36 | 36 | $this->config = $config; |
| 37 | - if( !class_exists('\Swift_Mailer') ) { |
|
| 37 | + if (!class_exists('\Swift_Mailer')) { |
|
| 38 | 38 | require_once dirname(__FILE__).'../../../vendor/swiftmailer/swiftmailer/lib/swift_required.php'; |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function getMailer() |
| 47 | 47 | { |
| 48 | - if(is_null($this->mailer)) |
|
| 48 | + if (is_null($this->mailer)) |
|
| 49 | 49 | { |
| 50 | 50 | if (isset($this->config['type']) && $this->config['type'] == 'smtp') { |
| 51 | 51 | $transport = \Swift_SmtpTransport::newInstance($this->config['smtp_options']['host'], $this->config['smtp_options']['port']); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * (non-PHPdoc) |
| 68 | 68 | * @see \JaegerApp\Email\SwiftAbstract::getMessage() |
| 69 | 69 | */ |
| 70 | - public function getMessage(array $to, $from_email, $from_name, $subject, $message_body, array $attachments, $mail_type='html') |
|
| 70 | + public function getMessage(array $to, $from_email, $from_name, $subject, $message_body, array $attachments, $mail_type = 'html') |
|
| 71 | 71 | { |
| 72 | 72 | $message = \Swift_Message::newInstance(); |
| 73 | 73 | $message->setTo($to); |
@@ -9,13 +9,13 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | namespace JaegerApp\Email; |
| 11 | 11 | |
| 12 | -use Swift_SmtpTransport; |
|
| 13 | -use Swift_MailTransport; |
|
| 14 | -use Swift_Message; |
|
| 15 | 12 | use Swift_Attachment; |
| 13 | +use Swift_MailTransport; |
|
| 16 | 14 | use Swift_Mailer; |
| 17 | -use Swift_Plugins_Loggers_ArrayLogger; |
|
| 15 | +use Swift_Message; |
|
| 18 | 16 | use Swift_Plugins_LoggerPlugin; |
| 17 | +use Swift_Plugins_Loggers_ArrayLogger; |
|
| 18 | +use Swift_SmtpTransport; |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * Jaeger - Swift5 Email Abstraction |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | public function getMailer() |
| 28 | 28 | { |
| 29 | - if(is_null($this->mailer)) |
|
| 29 | + if (is_null($this->mailer)) |
|
| 30 | 30 | { |
| 31 | 31 | if (isset($this->config['type']) && $this->config['type'] == 'smtp') { |
| 32 | 32 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | return $this->mailer; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - public function getMessage(array $to, $from_email, $from_name, $subject, $message_body, array $attachments, $mail_type='html') |
|
| 50 | + public function getMessage(array $to, $from_email, $from_name, $subject, $message_body, array $attachments, $mail_type = 'html') |
|
| 51 | 51 | { |
| 52 | 52 | $to_list = new \Swift_RecipientList(); |
| 53 | 53 | foreach ($to as $key => $addr) { |
@@ -342,9 +342,9 @@ discard block |
||
| 342 | 342 | public function getMailer() |
| 343 | 343 | { |
| 344 | 344 | if (is_null($this->mailer)) { |
| 345 | - if(class_exists('\Swift')) |
|
| 345 | + if (class_exists('\Swift')) |
|
| 346 | 346 | { |
| 347 | - if(version_compare(\Swift::VERSION, 4, '<=') && version_compare(\Swift::VERSION, 3, '>=')) |
|
| 347 | + if (version_compare(\Swift::VERSION, 4, '<=') && version_compare(\Swift::VERSION, 3, '>=')) |
|
| 348 | 348 | { |
| 349 | 349 | $mailer = new Email\Swift3($this->config); |
| 350 | 350 | } |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | } |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | - if (! $valid_emails) { |
|
| 406 | + if (!$valid_emails) { |
|
| 407 | 407 | return; |
| 408 | 408 | } |
| 409 | 409 | |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | $body_message = $this->getView()->render($this->getMessage(), $vars); |
| 413 | 413 | $message = $mailer->getMessage($valid_emails, $this->config['from_email'], $this->config['sender_name'], $subject, $body_message, $this->getAttachments(), $this->getMailtype()); |
| 414 | 414 | |
| 415 | - if (! $mailer->send($message)) { |
|
| 415 | + if (!$mailer->send($message)) { |
|
| 416 | 416 | print_r($mailer->getMailer()->mailer_logger->dump()); |
| 417 | 417 | exit(); |
| 418 | 418 | throw new EmailException($this->getMailer()->ErrorInfo); |
@@ -347,12 +347,10 @@ |
||
| 347 | 347 | if(version_compare(\Swift::VERSION, 4, '<=') && version_compare(\Swift::VERSION, 3, '>=')) |
| 348 | 348 | { |
| 349 | 349 | $mailer = new Email\Swift3($this->config); |
| 350 | - } |
|
| 351 | - else { |
|
| 350 | + } else { |
|
| 352 | 351 | $mailer = new Email\Swift5($this->config); |
| 353 | 352 | } |
| 354 | - } |
|
| 355 | - else { |
|
| 353 | + } else { |
|
| 356 | 354 | $mailer = new Email\Swift5($this->config); |
| 357 | 355 | } |
| 358 | 356 | |