Skip to content

Commit c53f695

Browse files
Merge pull request #9 from whernandez/master
Fix Mailer service calling namespace Smtp::class
2 parents 8887d2e + d34f843 commit c53f695

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Service/Mailer.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Mailer {
1818

1919
/** @var Environment $templating */
2020
private $templating;
21-
21+
2222
/** @var bool $devMode */
2323
private $devMode = false;
2424

@@ -132,8 +132,8 @@ public function check(OutputInterface $output = null) {
132132

133133
$em = $this->container->get('doctrine')->getManager();
134134

135-
$configurations = $em->getRepository('NTIEmailBundle:Smtp')->findAll();
136-
135+
$configurations = $em->getRepository(Smtp::class)->findAll();
136+
137137
/** @var Smtp $smtp */
138138
foreach ($configurations as $smtp){
139139
$this->handleSmtpSpool($smtp, $output);
@@ -195,7 +195,7 @@ public function handleSmtpSpool(Smtp $smtp, OutputInterface $output = null){
195195
$filename = null;
196196
$tempSpoolPath = $email->getPath().$email->getHash()."/";
197197
// Read the temporary spool path
198-
$files = scandir($tempSpoolPath, SORT_ASC);
198+
$files = scandir($tempSpoolPath, SORT_ASC);
199199
foreach($files as $file) {
200200
if ($file == "." || $file == "..") continue;
201201
$filename = $file;
@@ -230,7 +230,7 @@ public function handleSmtpSpool(Smtp $smtp, OutputInterface $output = null){
230230
}
231231
}
232232
try {
233-
$em->flush();
233+
$em->flush();
234234
} catch (\Exception $ex) {
235235
$this->container->get('logger')->log(\Monolog\Logger::CRITICAL, StringUtilities::BeautifyException($ex));
236236
}
@@ -308,7 +308,7 @@ private function processEmail($from, $to, $cc = array(), $bcc = array(), $subjec
308308
$this->container->get('logger')->log(\Monolog\Logger::CRITICAL, "At least one email is required");
309309
return false;
310310
}
311-
311+
312312
/** @var Swift_Message $message */
313313
$message = new \Swift_Message($subject);
314314
$message->setFrom($from);
@@ -331,7 +331,7 @@ private function processEmail($from, $to, $cc = array(), $bcc = array(), $subjec
331331

332332
if(is_array($bcc)) {
333333
foreach($bcc as $recipient) {
334-
if($recipient != "" && filter_var($recipient, FILTER_VALIDATE_EMAIL)) {
334+
if($recipient != "" && filter_var($recipient, FILTER_VALIDATE_EMAIL)) {
335335
$message->addBcc($recipient);
336336
}
337337
}
@@ -413,9 +413,9 @@ private function processEmail($from, $to, $cc = array(), $bcc = array(), $subjec
413413
} catch (\Exception $ex) {
414414
$this->container->get('logger')->log(\Monolog\Logger::CRITICAL, StringUtilities::BeautifyException($ex));
415415
}
416-
416+
417417
}
418-
418+
419419
// Save the email and delete the hash directory
420420
$em = $this->container->get('doctrine')->getManager();
421421
$email = new Email();
@@ -424,7 +424,7 @@ private function processEmail($from, $to, $cc = array(), $bcc = array(), $subjec
424424
$recipients = (is_array($message->getTo())) ? join(', ', array_keys($message->getTo())) : $message->getTo();
425425
$ccRecipients = (is_array($message->getCc())) ? join(', ', array_keys($message->getCc())) : $message->getCc();
426426
$bccRecipients = (is_array($message->getBcc())) ? join(', ', array_keys($message->getBcc())) : $message->getBcc();
427-
427+
428428
$email->setFilename($filename);
429429
$email->setPath($smtp->getSpoolDir()."/");
430430
$email->setMessageFrom($from);

0 commit comments

Comments
 (0)