Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require __DIR__ . '/vendor/autoload.php';
- $smtpHost = 'ssl://smtp.yandex.com';
- $smtpPort = 465;
- $security = null;
- $smtpUsername = 'mob-pro-test@yandex.ru';
- $smtpPassword = 'mob-pro1234';
- /*
- * Create the Transport
- */
- $transport = (new Swift_SmtpTransport($smtpHost, $smtpPort, $security))
- ->setUsername($smtpUsername)
- ->setPassword($smtpPassword)
- ;
- //$transport = Swift_SmtpTransport::newInstance('smtp.yandex.ru', 465, 'ssl')/
- // ->setUsername('email@yandex.ru')
- //->setPassword('password');
- /*
- * Create the Mailer using your created Transport
- */
- $mailer = new Swift_Mailer($transport);
- /*
- * Create a message
- */
- $from = ['john@doe.com' => 'John Doe'];
- $to = 'yury_borisov@rambler.ru';
- $subject = 'Wonderful Subject';
- $body = 'Test';
- $message = (new Swift_Message($subject))
- ->setFrom($from)
- ->setTo([$to])
- ->setBody('Here is the message itself')
- ;
- /*
- * Send the message
- */
- $result = $mailer->send($message);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement