Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function sendMail() |
||
17 | { |
||
18 | if (is_null($this->emailMessage)) { |
||
19 | throw new RuntimeException('You need to create the message first and chain it.'); |
||
20 | } |
||
21 | |||
22 | $transport = Swift_SmtpTransport::newInstance(getenv('MAIL_HOST'), getenv('MAIL_PORT')); |
||
23 | $mailer = Swift_Mailer::newInstance($transport); |
||
24 | |||
25 | if (!$mailer->send($this->emailMessage)) { |
||
26 | throw new RuntimeException('Can\'t send the Email message'); |
||
27 | } |
||
28 | |||
29 | $this->emailMessage = null; |
||
30 | } |
||
31 | |||
59 |