Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Zend Mail and Swift Mailer examples
// Zend Mail
use Zend\Mail;
$mail = new Mail\Message();
$mail->setBody('This is the text of the email.');
$mail->setFrom('', 'My site');
$mail->addTo('', 'Their name');
$mail->setSubject('Test Subject');
$transport = new Mail\Transport\Sendmail();
// Swift Mailer
$message = Swift_Message::newInstance();
'' => 'My site',
'' => 'Their name',
$message->setSubject('My subject');
$message->setBody('Hello world', 'text/plain');
$transport = Swift_MailTransport::newInstance();
$mailer = Swift_Mailer::newInstance($transport);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.