Advertisement
Guest User

Untitled

a guest
Mar 20th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. <?php
  2. require_once "Mail.php";
  3.  
  4. $from = "Home Calendar <calendar@home>";
  5. $to = "Me Yahoo <me@yahoo.co.uk>, Me Gmail <me@gmail.com>";
  6. $subject = "TESTING PHP EMAIL";
  7. $body = "
  8. <html>
  9. <head>
  10. <title>HTML email</title>
  11. </head>
  12. <body>
  13. <p>This email contains HTML Tags!</p>
  14. <table>
  15. <tr>
  16. <th>Firstname</th>
  17. <th>Lastname</th>
  18. </tr>
  19. <tr>
  20. <td>Ricardo</td>
  21. <td>Wagemaker</td>
  22. </tr>
  23. </table>
  24. </body>
  25. </html>
  26. ";
  27.  
  28. $host = "ssl://mail.domain.co.uk";
  29. $port = "465";
  30. $username = "name@domain.co.uk";
  31. $password = "password";
  32.  
  33. $headers = array (
  34. "MIME-Version: 1.0",
  35. "Content-type: text/html; charset=ISO-8859-1",
  36. 'From' => $from,
  37. 'To' => $to,
  38. 'Subject' => $subject
  39. );
  40.  
  41. $smtp = Mail::factory('smtp',
  42. array ('host' => $host,
  43. 'port' => $port,
  44. 'auth' => true,
  45. 'username' => $username,
  46. 'password' => $password));
  47.  
  48. $mail = $smtp->send($to, $headers, $body, $from, $subject);
  49.  
  50. if (PEAR::isError($mail)) {
  51. echo("<p>" . $mail->getMessage() . "</p>");
  52. } else {
  53. echo("nn<p>Message successfully sent!</p>nn");
  54. }
  55. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement