Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require __DIR__ . '/vendor/autoload.php';
- $smtpHost = 'smtp.yandex.ru';
- $smtpPort = 587;
- $smtpUsername = 'mob-pro-test@yandex.ru';
- $smtpPassword = 'mob-pro1234';
- /*
- * Create the Transport
- */
- $transport = (new Swift_SmtpTransport($smtpHost, $smtpPort))
- ->setUsername($smtpUsername)
- ->setPassword($smtpPassword)
- ;
- /*
- * 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