Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2018
2,978
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. <?php
  2.  
  3. require __DIR__ . '/vendor/autoload.php';
  4.  
  5. $smtpHost = 'smtp.yandex.ru';
  6. $smtpPort = 587;
  7. $smtpUsername = 'mob-pro-test@yandex.ru';
  8. $smtpPassword = 'mob-pro1234';
  9.  
  10. /*
  11. * Create the Transport
  12. */
  13. $transport = (new Swift_SmtpTransport($smtpHost, $smtpPort))
  14. ->setUsername($smtpUsername)
  15. ->setPassword($smtpPassword)
  16. ;
  17.  
  18. /*
  19. * Create the Mailer using your created Transport
  20. */
  21. $mailer = new Swift_Mailer($transport);
  22.  
  23. /*
  24. * Create a message
  25. */
  26. $from = ['john@doe.com' => 'John Doe'];
  27. $to = 'yury_borisov@rambler.ru';
  28. $subject = 'Wonderful Subject';
  29. $body = 'Test';
  30. $message = (new Swift_Message($subject))
  31. ->setFrom($from)
  32. ->setTo($to)
  33. ->setBody('Here is the message itself')
  34. ;
  35.  
  36. /*
  37. * Send the message
  38. */
  39. $result = $mailer->send($message);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement