Like us on Facebook and stand a chance to win pen drives!

Sending Emails with Swift Mailer

 
 Swift Mailer
 Swift Mailer

"Swift Mailer integrates into any web app written in PHP 5, offering a flexible and elegant object-oriented approach to sending emails with a multitude of features."

Download Documentation


<!--?php require_once 'swiftmailer/lib/swift_required.php'; // Create the Transport //SMTP /*$transport = Swift_SmtpTransport::newInstance('smtp.example.org', 25) --->setUsername('your username')
->setPassword('your password')
;
 
*/
 
// Sendmail
//$transport = Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -bs');
 
// Mail
$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('receiver@domain.org', 'other@domain.org' => 'A name'))
->setBody('Here is the message itself')
;
 
// Send the message
$result = $mailer->send($message);
?>




0 comments:

Copyright © 2012 The Code Junction.