Guest User

Untitled

a guest
Sep 7th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. sending mail using php gmail swiftmailer = error -> where is the problem?
  2. function SendCookieToTheMail()
  3. {
  4. require_once 'swift-mailer/lib/swift_required.php';
  5. //Create the Transport
  6. $transport = Swift_SmtpTransport::newInstance('smtp.gmail.com')
  7. ->setPort(465)
  8. ->setEncryption('ssl')
  9. ->setUsername('007@gmail.com')
  10. ->setPassword('123')
  11. ;
  12.  
  13. //Create the Mailer using your created Transport
  14. $mailer = Swift_Mailer::newInstance($transport);
  15.  
  16. //Create a message
  17. $message = Swift_Message::newInstance('Test')
  18. ->setFrom(array('007@gmail.com' => 'From mr. 007'))
  19. ->setTo(array('007@gmail.com', '007@gmail.com' => 'To mr. 007'))
  20. ->setBody('Body')
  21. ;
  22.  
  23. //Send the message
  24. $result = $mailer->send($message);
  25.  
  26. /*
  27. You can alternatively use batchSend() to send the message
  28.  
  29. $result = $mailer->batchSend($message);
  30. */
  31. }
  32.  
  33. phpinfo();
  34.  
  35. ;extension=php_openssl.dll
Add Comment
Please, Sign In to add comment