Guys, need help again, I cant get my mail script working...

here is my code

 require_once "Mail.php";
 $from = "Sandra Sender <>";
 $to = "Ramona Recipient <>";
 $subject = "Hi!";
 $body = "Hi,\n\nHow are you?";
 $host = "ssl://";
 $port = "465";
 $username = "smtp_username";
 $password = "smtp_password";
 $headers = array ('From' => $from,
   'To' => $to,
   'Subject' => $subject);
 $smtp = Mail::factory('smtp',
   array ('host' => $host,
     'port' => $port,
     '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>");

im working on a linux there something i need to install?

thank you guys!!!

You got this example from SO ? It is designed to work with gmail, so change your sender email addresses and username and password. I am assuming you already have PEAR installed.

The first argument to this function is the recipient, the second specifies the message's subject and the third one should contain the body. So to send a simple sample message, we could use:

$to = "";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");

@pritaeas - my pear is working , still no luck.. i google some alternative for this and I found the phpmailer and it works.... but still i want this to pursue this using pear..

@ppt123 - ill try ur suggestion

thank you guys

Solved ? If then, mark as Solved.

@zero13 - thanks for the reminder

@pritaeas - thanks! I will give it a try