symfony html mail via swift mailer


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $mail_body = '<p>custom html mail content</p>';
  2. $message = Swift_Message::newInstance('Message title')
  3. ->setFrom(array('sender'))
  4. ->setTo(array('receiver'))
  5. ->setBody($mail_body, 'text/html', 'utf-8');
  6.  
  7. try {
  8. $this->getMailer()->send($message);
  9. }
  10. catch(Exception $e) {
  11. // yay
  12. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.