@@ -18,7 +18,7 @@ class Mailer {
18
18
19
19
/** @var Environment $templating */
20
20
private $ templating ;
21
-
21
+
22
22
/** @var bool $devMode */
23
23
private $ devMode = false ;
24
24
@@ -132,8 +132,8 @@ public function check(OutputInterface $output = null) {
132
132
133
133
$ em = $ this ->container ->get ('doctrine ' )->getManager ();
134
134
135
- $ configurations = $ em ->getRepository (' NTIEmailBundle: Smtp' )->findAll ();
136
-
135
+ $ configurations = $ em ->getRepository (Smtp::class )->findAll ();
136
+
137
137
/** @var Smtp $smtp */
138
138
foreach ($ configurations as $ smtp ){
139
139
$ this ->handleSmtpSpool ($ smtp , $ output );
@@ -195,7 +195,7 @@ public function handleSmtpSpool(Smtp $smtp, OutputInterface $output = null){
195
195
$ filename = null ;
196
196
$ tempSpoolPath = $ email ->getPath ().$ email ->getHash ()."/ " ;
197
197
// Read the temporary spool path
198
- $ files = scandir ($ tempSpoolPath , SORT_ASC );
198
+ $ files = scandir ($ tempSpoolPath , SORT_ASC );
199
199
foreach ($ files as $ file ) {
200
200
if ($ file == ". " || $ file == ".. " ) continue ;
201
201
$ filename = $ file ;
@@ -230,7 +230,7 @@ public function handleSmtpSpool(Smtp $smtp, OutputInterface $output = null){
230
230
}
231
231
}
232
232
try {
233
- $ em ->flush ();
233
+ $ em ->flush ();
234
234
} catch (\Exception $ ex ) {
235
235
$ this ->container ->get ('logger ' )->log (\Monolog \Logger::CRITICAL , StringUtilities::BeautifyException ($ ex ));
236
236
}
@@ -308,7 +308,7 @@ private function processEmail($from, $to, $cc = array(), $bcc = array(), $subjec
308
308
$ this ->container ->get ('logger ' )->log (\Monolog \Logger::CRITICAL , "At least one email is required " );
309
309
return false ;
310
310
}
311
-
311
+
312
312
/** @var Swift_Message $message */
313
313
$ message = new \Swift_Message ($ subject );
314
314
$ message ->setFrom ($ from );
@@ -331,7 +331,7 @@ private function processEmail($from, $to, $cc = array(), $bcc = array(), $subjec
331
331
332
332
if (is_array ($ bcc )) {
333
333
foreach ($ bcc as $ recipient ) {
334
- if ($ recipient != "" && filter_var ($ recipient , FILTER_VALIDATE_EMAIL )) {
334
+ if ($ recipient != "" && filter_var ($ recipient , FILTER_VALIDATE_EMAIL )) {
335
335
$ message ->addBcc ($ recipient );
336
336
}
337
337
}
@@ -413,9 +413,9 @@ private function processEmail($from, $to, $cc = array(), $bcc = array(), $subjec
413
413
} catch (\Exception $ ex ) {
414
414
$ this ->container ->get ('logger ' )->log (\Monolog \Logger::CRITICAL , StringUtilities::BeautifyException ($ ex ));
415
415
}
416
-
416
+
417
417
}
418
-
418
+
419
419
// Save the email and delete the hash directory
420
420
$ em = $ this ->container ->get ('doctrine ' )->getManager ();
421
421
$ email = new Email ();
@@ -424,7 +424,7 @@ private function processEmail($from, $to, $cc = array(), $bcc = array(), $subjec
424
424
$ recipients = (is_array ($ message ->getTo ())) ? join (', ' , array_keys ($ message ->getTo ())) : $ message ->getTo ();
425
425
$ ccRecipients = (is_array ($ message ->getCc ())) ? join (', ' , array_keys ($ message ->getCc ())) : $ message ->getCc ();
426
426
$ bccRecipients = (is_array ($ message ->getBcc ())) ? join (', ' , array_keys ($ message ->getBcc ())) : $ message ->getBcc ();
427
-
427
+
428
428
$ email ->setFilename ($ filename );
429
429
$ email ->setPath ($ smtp ->getSpoolDir ()."/ " );
430
430
$ email ->setMessageFrom ($ from );
0 commit comments