email using PEAR

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I grabbed the following script from a website and installed the
Socket.php file in the /usr/share/pear/Net directory on a RH 8.0 Linux
box. When I run the script it displays the "Mail sent" message but no
mail actually arrives in my mailbox.


$recipients = "";

$headers["From"]    = "";
$headers["To"]      = "";
$headers["Subject"] = "Test message";

$body = "TEST MESSAGE!!!";

$params["host"] = "my.smtp.server";
$params["port"] = "25";
$params["auth"] = true;
$params["username"] = "myusername";
$params["password"] = "mypassword";

// Create the mail object using the Mail::factory method
$mail_object =& Mail::factory("smtp", $params);

$mail_object->send($recipients, $headers, $body);

echo "Mail has been sent!!\n";


I was told that it was much easier to use PEAR than to try setting up
sendmail on my system.

Any comments would be greatly appreciated.


Site Timeline