Advertisement
Guest User

Untitled

a guest
Mar 1st, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.70 KB | None | 0 0
  1. <?php
  2. require_once "Mail.php";
  3.  
  4. $from = "Sandra Sender <fallah@goldnetgroup.com>";
  5. $to = "Ramona Recipient <info@goldnetgroup.com>";
  6. $subject = "Hi!";
  7. $body = "Hi,\n\nHow are you?";
  8.  
  9. $host = "mail.goldnetgroup.com";
  10. $username = "smtp_username";
  11. $password = "smtp_password";
  12.  
  13. $headers = array ('From' => $from,
  14.     'To' => $to,
  15.     'Subject' => $subject);
  16. $smtp = Mail::factory('smtp',
  17.     array ('host' => $host,
  18.         'auth' => true,
  19.         'username' => $username,
  20.         'password' => $password));
  21.  
  22. $mail = $smtp->send($to, $headers, $body);
  23.  
  24. if (PEAR::isError($mail)) {
  25.     echo("<p>" . $mail->getMessage() . "</p>");
  26. } else {
  27.     echo("<p>Message successfully sent!</p>");
  28. }
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement