Created
May 9, 2014 11:13
-
-
Save pedro-vasconcelos/280a12a9cc7b11b0dac3 to your computer and use it in GitHub Desktop.
Code to send e-mail with Swiftmailer and Amazon SES
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "swift-mailer-510/lib/swift_required.php"; | |
| $message = Swift_Message::newInstance() | |
| ->setCharset('utf-8') | |
| ->setSubject('Your subject') | |
| ->setFrom(array('from@example.com' => 'From Name')) | |
| ->setTo(array('to@example.com' => 'To Name')) | |
| ->setBody('Here is the message itself') | |
| ->addPart('<q>Here is the message itself</q>', 'text/html') | |
| ; | |
| $transport = Swift_SmtpTransport::newInstance('http://email-smtp.us-east-1.amazonaws.com', 587, 'tls') | |
| ->setUsername('Amazon STMP Username') | |
| ->setPassword('Amazon STMP Password') | |
| ; | |
| #$transport = Swift_MailTransport::newInstance(); | |
| $mailer = Swift_Mailer::newInstance($transport); | |
| $result = $mailer->send($message); | |
| var_dump($result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment