Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. <?php
  2. require_once "Mail.php";
  3. require_once "Mail/mime.php";
  4.  
  5. $from = "Luis <luis@gyeeply.com;>";
  6. $to = "Rachel Recipient <javi@yeeply.com>";
  7. $subject = "Hi!";
  8. $text = "Hi,\n\nIt is a text message";
  9. $html = "It is a <b>HTML</b> message";
  10. $mime = new Mail_mime();
  11. $mime->setHTMLBody($html);
  12. $mime->setTXTBody($text);
  13. $body = $mime->get();
  14.  
  15. $host = "smtpcorp.com"; // Enter 'ssl://' and your SMTP2GO account's SMTP server.
  16. $port = "2525"; // 8465 can also be used.
  17. $username = "luis@yeeply.com";
  18. $password = "PASS";
  19.  
  20. $headers = array ('From' => $from,
  21. 'To' => $to,
  22. 'Subject' => $subject);
  23. $headers = $mime->headers($headers);
  24. $smtp = Mail::factory('smtp',
  25. array (
  26. 'host' => $host,
  27. 'port' => $port,
  28. 'auth' => true,
  29. 'username' => $username,
  30. 'password' => $password
  31. )
  32. );
  33.  
  34. $mail = $smtp->send($to, $headers, $body);
  35.  
  36. if (PEAR::isError($mail)) {
  37. echo("<p>" . $mail->getMessage() . "</p>");
  38. } else {
  39. echo("<p>Message successfully sent!</p>");
  40. }
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement