public function send(Mail $mail) { $converter = new MailToPHPMailerConverter(); $this->mailer = $converter->convert($mail); $this->set_send_settings($this->mailer); try { $this->mailer->Send(); } catch (Exception $ex) { throw new IOException('Mail couldn\'t be sent: ' . $ex->getMessage()); } }
public function testBasicMailConversion() { $mail = new Mail(); $mail->add_recipient('*****@*****.**', 'Toto'); $mail->set_sender('*****@*****.**', 'Tata'); $mail->set_content('hello world'); $mail->set_subject('hello'); $converter = new MailToPHPMailerConverter(); $phpmailer = $converter->convert($mail); self::assertEquals('hello', $phpmailer->Subject); self::assertEquals('hello world', $phpmailer->Body); }