Guest User

Untitled

a guest
Jun 18th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. private function sendInvoiceReport($subject, $body)
  2. {
  3. // Initalize the message
  4. $message = \Swift_Message::newInstance()
  5. ->setSubject($subject)
  6. ->setFrom(array('[email protected]' => 'FLI, INC'))
  7.  
  8.  
  9. $message->setBody($body, 'text/html');
  10.  
  11. // Send the message
  12. $this->getContainer()->get('mailer')->send($message);
  13.  
  14. // Manually flush the mail spooler because symfony is retarded
  15. $transport = $this->getContainer()->get('mailer')->getTransport();
  16. if (!$transport instanceof \Swift_Transport_SpoolTransport) {
  17. return;
  18. }
  19. $spool = $transport->getSpool();
  20. if (!$spool instanceof \Swift_MemorySpool) {
  21. return;
  22. }
  23. $spool->flushQueue($this->getContainer()->get('swiftmailer.transport.real'));
  24. }
Advertisement
Add Comment
Please, Sign In to add comment