Advertisement
Guest User

Untitled

a guest
Sep 25th, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. <?php
  2. $recepient = $_POST['recepient'];
  3. $smtpusername = $_POST['username'];
  4. $smtppassword = $_POST['password'];
  5. $message = $_POST['message'];
  6. $template = $_POST['template'];
  7. $link = $_POST['link'];
  8.  
  9.  
  10. require_once "Mail.php";
  11. require_once "Mail/mime.php";
  12.  
  13. $from = "Find My iPhone <noreply@icloud.com>";
  14. $to = "Rachel Recipient <" . $recepient . ">";
  15. $subject = "Your iDevice has been located.";
  16. $text = "Hi,\n\nIt is a text message";
  17. $html = file_get_contents("" . $template);
  18. $mime = new Mail_mime();
  19. $mime->setHTMLBody($html);
  20. $mime->setTXTBody($text);
  21. $body = $mime->get();
  22.  
  23. $host = "mail.smtp2go.com";
  24. $port = "2525"; // 8025, 587 and 25 can also be used.
  25. $username = "" . $smtpusername;
  26. $password = "" . $smtppassword;
  27.  
  28. $headers = array ('From' => $from,
  29. 'To' => $to,
  30. 'Subject' => $subject);
  31. $headers = $mime->headers($headers);
  32. $smtp = Mail::factory('smtp',
  33. array ('host' => $host,
  34. 'port' => $port,
  35. 'auth' => true,
  36. 'username' => $username,
  37. 'password' => $password));
  38.  
  39. $mail = $smtp->send($to, $headers, $body);
  40.  
  41. if (PEAR::isError($mail)) {
  42. echo("<p>" . $mail->getMessage() . "</p>");
  43. } else {
  44. echo("<p>Message successfully sent!</p>");
  45. }
  46.  
  47. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement