【发布时间】:2014-12-15 15:43:02
【问题描述】:
这是我的代码:
require 'phpmailertesting/PHPMailerAutoload.php';
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'send.one.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'myemailhidden'; // SMTP username
$mail->Password = 'mypasswordhidden'; // SMTP password
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465; // TCP port to connect to
$mail->From = 'myemailhidden';
$mail->FromName = 'My Name';
$mail->addAddress('example@example.com'); // Name is optional
$mail->addCC('cc@example.com');
$mail->addBCC('bcc@example.com');
//$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
我已尝试将端口和安全连接类型更改为“TSL”和“SSL”,但什么也没有。我已经看过答案,但没有一个能解决它。有什么答案吗?谢谢
我启用了 SMTP 调试器,这就是它所说的“连接:打开到 ssl://send.one.com:465, t=300, opt=array () 2014-12-15 15:46:40 SMTP 错误:连接服务器失败:连接超时 (110) 2014-12-15 15:46:40 SMTP connect() failed"
【问题讨论】:
-
telnet send.one.com 465为我工作。完全取出$mail->SMTPSecure行,看看是否可行? -
试过了。仍然失败并出现同样的错误:(
-
谁是您的虚拟主机?可能有一些传出 IPTables 规则阻止您从端口 465 进行通信。
-
one.com。我将尝试使用我的谷歌帐户。看看这是否有效:)
-
这是他们的说法,您需要找到更好的 ISP。