无法使用PHPMailer连接到SMTP但能够连接Pingability

时间:2015-09-01 13:39:19

标签: php email smtp phpmailer

尝试连接到Exchange服务器以使用PHPMailer发送邮件时,我收到SMTP ERROR: Failed to connect to server: Connection refused (111) 2015-09-01 13:30:34 SMTP connect() failed。我不认为这是凭证的问题,因为我使用相同的凭据在pingability.com上进行测试,我能够连接和发送没有任何问题。 openssl扩展也已启用。

我正在使用的代码:

require_once 'vendor/PHPMailer/PHPMailerAutoload.php';

$emailer = new PHPMailer();
$emailer->IsSMTP();
$emailer->SMTPDebug = 2;
$emailer->Host = "xxx.xxxxxxx.com";
$emailer->Username = "xxxxx";
$emailer->Password = "xxxxx";
$emailer->Port = 25;
$emailer->isHTML(true);
$emailer->From = "xxx@xxxxxx.com";
$emailer->FromName = 'xxxxxxxxx';
$emailer->Subject = "Reset Your Password";
$emailer->Body = "To reset your password, please visit this link:<br>" . $link;
$emailer->AddAddress( $email );
$emailer->AddAddress( "xxx@xxxxxx.com" );
$emailer->Send();

0 个答案:

没有答案