PHP Code not sending mail to customer

  • musty202
  • Born
  • Born
  • musty202
  • Posts: 3

Post 3+ Months Ago

Please i need help on the code below, its not sending mail to the customer, someone should come to my rescue
Code: [ Select ]
<?php
require_once "/usr/lib/php/pear/Mail.php";

$from = " <>";
$to = "test1 <>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";

$host = "";
$username = "";
$password = "test_123";

$headers = array ('From' => $from,
 'To' => $to,
 'Subject' => $subject);
$smtp = Mail::factory('smtp',
 array ('host' => $host,
  'auth' => true,
  'username' => $username,
  'password' => $password));

$mail = $smtp->send($to, $headers, $body);

if (PEAR::isError($mail)) {
 echo("<p>" . $mail->getMessage() . "</p>");
} else {
 echo("<p>Message successfully sent!</p>");
}
?>
  1. <?php
  2. require_once "/usr/lib/php/pear/Mail.php";
  3. $from = " <>";
  4. $to = "test1 <>";
  5. $subject = "Hi!";
  6. $body = "Hi,\n\nHow are you?";
  7. $host = "";
  8. $username = "";
  9. $password = "test_123";
  10. $headers = array ('From' => $from,
  11.  'To' => $to,
  12.  'Subject' => $subject);
  13. $smtp = Mail::factory('smtp',
  14.  array ('host' => $host,
  15.   'auth' => true,
  16.   'username' => $username,
  17.   'password' => $password));
  18. $mail = $smtp->send($to, $headers, $body);
  19. if (PEAR::isError($mail)) {
  20.  echo("<p>" . $mail->getMessage() . "</p>");
  21. } else {
  22.  echo("<p>Message successfully sent!</p>");
  23. }
  24. ?>
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Posts: 3422
  • Loc: Richland, WA

Post 3+ Months Ago

What it return any errors, or does it say it was a success?
  • musty202
  • Born
  • Born
  • musty202
  • Posts: 3

Post 3+ Months Ago

its showing successful, but the receiver wont get the mail
  • demonmaestro
  • Gold Member
  • Gold Member
  • User avatar
  • Posts: 675
  • Loc: Conroe, Texas

Post 3+ Months Ago

first off are you using an external smtp server or is the server on the one the site is on?

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 118 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.