By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,254 Members | 2,477 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,254 IT Pros & Developers. It's quick & easy.

Sending email using PEAR

P: 15
I'm using this code:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. require_once "Mail.php";
  3.  
  4. $from ="__MUNGED__";
  5. $to = "__MUNGED__";
  6. $subject = "Hi!";
  7. $body = "Hi,\n\nHow are you?";
  8.  
  9. $host = "__MUNGED__";
  10. $username = "pedjasmek";
  11. $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.   print "<p>" . "Message sent". "</p>";
  26.  } else {
  27.   print"<p>Message successfully sent!</p>";
  28.  }
  29. ?>
  30.  
and it won't work.Neither the first or the second message appears.
Dec 26 '07 #1
Share this Question
Share on Google+
1 Reply


pbmods
Expert 5K+
P: 5,821
Heya, Pedjasmek.

Do you get any error messages? Do you have debugging messages turned on?
Jan 2 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.