public function action_sendmail() { //Create the Transport $transport = Swift_MailTransport::newInstance(); //Create the Mailer using your created Transport $mailer = Swift_Mailer::newInstance($transport); //Create a message $message = Swift_Message::newInstance('Wonderful Subject') ->setFrom(array('john@doe.com' => 'John Doe')) ->setTo(array('you@domain.com')) ->setBody('Here is the message itself'); //Send the message $result = $mailer->send($message); }
public function action_sendmail() { Swift::factory('default') // load the default config that set up protocol, encoding, recipient, etc. ->setTo(array('you@domain.com')) ->setSubject('Wonderful Subject') ->setBody('Here is the message itself') ->send(); } }
$message = Swift_Message::newInstance('Wonderful Subject') ->setFrom(array('system@example.com' => 'System')) ->setTo(array('john.doe@example.com' => 'John Doe')) ->attach(new Swift_MimePart($email_body_text)) ->attach(new Swift_MimePart($email_body_html, 'text/html')) ;
$email_body_text = View::forge('path/to/emailtemplatetext'); $email_body_html = View::forge('path/to/emailtemplatehtml');
It looks like you're new here. If you want to get involved, click one of these buttons!