Swiftmailer sending email via gmail.com
Posted on October 2, 2016, 10:30 pm, by admin, under
php.
<?php
$transport = \Swift_SmtpTransport::newInstance('smtp.gmail.com',465)
->setUsername('yourusername@yourdomain.com')
->setPassword('yourpassword')
->setEncryption('ssl')
->setAuthMode('login');
$mailer = \Swift_Mailer::newInstance($transport);
$message = \Swift_Message::newInstance()
->setSubject('Welcome')
->setFrom(array('yourusername@yourdomain.com'))
->setTo(array('to@to.com'))
->setBody('hello world')
->setContentType("text/plain");
$mailer->send($message); |