PHP Mail - Serious problem

I’ve got a serious problem trying to use the mail() function. The new VPS server I’m using requires authentication. This nullifies the mail() function’s usefulness, I’m told. The company tells me that they cannot disable the authentication requirement for my account, and suggested the following solution, found at … 073006.htm:

require_once "Mail.php";

$from = "Sandra Sender <[email protected]>";
$to = "Ramona Recipient <[email protected]>";
$subject = "Hi!";
$body = "Hi,nnHow 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>");

I’m really having a hard time understanding this script and making it work. Frankly, I’d rather just disable authentication, but that is apparently not an option. SO, HERE’S WHERE I’M AT: The solution script they suggested begins with a require_once"Mail.php" command, BUT WHAT IS THIS FILE? Where do they say what’s in it? How can I require a file that I don’t have. As usual, I’m sure the solution is easy for others to understand, but my limited experience with this makes it VERY VERY difficult. I NEED HELP PLEEEEEEASE!

Directly from the page you’re linking to:

Make sure the PEAR Mail package is installed.

Mail.php is included in the PEAR mail package.

Sponsor our Newsletter | Privacy Policy | Terms of Service