I\'m using Windows Vista OS. PHP, MySQL as the database and Apache web server.
I want to send notification to those who want to join in my site. But the problem is w
Use the Pear "Mail" class, which requires access to a separate SMTP server listening on port 25.
Sample code follows:
function sendmail($from, $to, $subject, $message, $headers)
{
if (is_array($to)) {
$recipients = implode(', ', $to);
} else {
$recipients = $to;
}
$errorlevel = error_reporting();
$headers["From"] = $from;
$headers["To"] = $to;
$headers["Subject"] = $subject;
$params = array();
$params["host"] = "localhost";
$params["port"] = "25";
$params["auth"] = false;
error_reporting($errorlevel & ~E_WARNING);
$mail_object =& Mail::factory("smtp", $params);
$res = $mail_object->send($recipients, $headers, $message);
error_reporting($errorlevel);
return $res;
}
nb: this is old code - I don't recall now why I had to mask out E_WARNING