尝试连接到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();