Hi all,
Trying to use PEAR Mail class to send emails via my ISP's SMTP server, but each time I get the following error:
Failed to connect to smtp.dsl.pipex.com:25 [SMTP: Failed to connect socket: Connection refused (code: -1, response: )]
Here is the code I am using:
require_once("Mail.php");
$recipients = 'nick@cole2.com';
$headers['From'] = 'nick@drumsense.com';
$headers['To'] = 'nick@cole2.com';
$headers['Subject'] = 'Test message';
$body = 'Test message';
$params['host'] = "smtp.dsl.pipex.com";
$params['port'] = 25;
$params['auth'] = false;
$params['debug'] = false;
$params['username'] = "";
$params['password'] = "";
// Create the mail object using the Mail::factory method
$mail_object = Mail::factory('smtp',$params);
$send = $mail_object->send($recipients, $headers, $body);
if (PEAR::isError($send)) {
print($send->getMessage());
} else {
echo("Email sent successfully");
}
Really appreciate any suggestions on how to avoid this, or at least move forwards!!
Nick.