/** * Sends the email using a given provider. * Throws an exception if setEmail * was not called previously. * * @return mixed * @throws \Mechant\MailerBundle\Exception\EmailMissingException */ public function send() { if ($this->email instanceof Mail) { $message = \Swift_Message::newInstance()->setSubject($this->email->getSubject())->setFrom($this->email->getFrom())->setTo($this->email->getTo())->setBody($this->email->getBody(), 'text/html'); return $this->mailer->send($message); } throw new EmailMissingException(); }
public function test_it_accepts_a_to_email_address() { $mail = new Mail(); $mail->setTo('*****@*****.**'); $this->assertEquals('*****@*****.**', $mail->getTo()); }