Advertisement
ViktorVanDarma

Untitled

Aug 26th, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. <?php
  2. require_once '_mapa/lib/swift_required.php';
  3.  
  4. // Mail Transport
  5. //$transport = Swift_SmtpTransport::newInstance('ssl://smtp.gmail.com', 465)
  6. $transport = (new Swift_SmtpTransport('ssl://smtp.gmail.com', 465))
  7. //$transport = (new Swift_SmtpTransport('ssl://smtp.gmail.com', 587));
  8. ->setUsername('sag.wataha@gmail.com') // Your Gmail Username
  9. ->setPassword(''); // Your Gmail Password
  10.  
  11. // Mailer
  12. //$mailer = Swift_Mailer::newInstance($transport);
  13. $mailer = new Swift_Mailer($transport);
  14. // Create a message
  15. //$message = Swift_Message::newInstance('Wonderful Subject Here')
  16. $message = (new Swift_Message('Wonderful Subject'))
  17. ->setFrom(array('sag.wataha@gmail.com' => 'SAG WATAHA')) // can be $_POST['email'] etc...
  18. ->setTo(array('' => 'Receiver Name')) // your email / multiple supported.
  19. ->setBody('Here is the <strong>message</strong> itself. It can be text or <h1>HTML</h1>.', 'text/html');
  20.  
  21. // Send the message
  22. if ($mailer->send($message)) {
  23. echo 'Mail sent successfully.';
  24. } else {
  25. echo 'I am sure, your configuration are not correct. :(';
  26. }
  27.  
  28.  
  29.  
  30. // Create the Transport
  31. //$transport = (new Swift_SmtpTransport('smtp.googlemail.com', 465, 'ssl'))
  32. // ->setUsername('')
  33. // ->setPassword('')
  34. //;
  35.  
  36. // Create the Mailer using your created Transport
  37. //$mailer = new Swift_Mailer($transport);
  38.  
  39. // Create a message
  40. //$message = (new Swift_Message('Wonderful Subject'))
  41. // ->setFrom(['' => 'John Doe'])
  42. // ->setTo(['' => 'A name'])
  43. // ->setBody('Here is the message itself')
  44. // ;
  45.  
  46. // Send the message
  47. //$result = $mailer->send($message);
  48. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement