Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2018
2,980
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 = '[email protected]';
  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 = ['[email protected]' => 'John Doe'];
  27. $subject = 'Wonderful Subject';
  28. $body = 'Test';
  29. $message = (new Swift_Message($subject))
  30. ->setFrom($from)
  31. ->setTo($to)
  32. ->setBody('Here is the message itself')
  33. ;
  34.  
  35. /*
  36. * Send the message
  37. */
  38. $result = $mailer->send($message);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement