Advertisement
Guest User

Untitled

a guest
Aug 7th, 2017
465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. <?php
  2.  
  3. // send.php
  4. // could be run as GUSER=yourAccountName@gmail.com GPASS="yourGmailPassword" php send.php
  5.  
  6. require_once __DIR__.'/vendor/autoload.php';
  7.  
  8. $transport = new Swift_SpoolTransport(new \Acme_Swift_QueueSpool(
  9. (new \Enqueue\Fs\FsConnectionFactory('file://'.__DIR__.'/queue'))->createContext()
  10. ));
  11.  
  12. $mailer = new Swift_Mailer($transport);
  13.  
  14. $message = (new Swift_Message('Wonderful Subject'))
  15. ->setFrom(getenv('GUSER'))
  16. ->setTo(getenv('GUSER'))
  17. ->setBody('Here is the message itself. Sent at: '.date('Y-m-d H:i:s'))
  18. ;
  19.  
  20. $result = $mailer->send($message);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement