Codeigniter 电子邮件不工作,超时错误

Codeigniter email not working, timeout error

我已经设置了新的电子邮件地址,以便能够通过我的 gmail 帐户发送邮件,使用以下详细信息:

(我更改了用户名以保护我的域的私密性)

这里使用 codeigniter 是我的配置文件,在更改托管服务之前,所有其他电子邮件内容都工作正常。 (我也更新了发送电子邮件的发件人地址)

$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://auth.smtp.1and1.co.uk';
$config['smtp_user'] = 'web@domain.com';
$config['smtp_pass'] = 'password';
$config['smtp_port'] = '465';
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$config['newline'] = "\r\n";
?>

在我看来它应该可以工作,但我一直收到超时消息。这从来没有帮助,因为这通常意味着我有错误的细节。

A PHP Error was encountered
Severity: Warning
Message: fsockopen(): unable to connect to ssl://auth.smtp.1and1.co.uk:465 (Connection timed out)

SSL OPEN 已启用,如 phpinfo() 中所示;

我使用了下面的代码,发现我的托管公司已经屏蔽了所有相关端口...

这里有一些代码可以确定您是否遇到了与我相同的问题:

   $fp = fsockopen('localhost', 80, $errno, $errstr, 5);
    if (!$fp) {
        echo('port 80 is closed or blocked.');
    } else {
        echo('port 80 is open and available');
        fclose($fp);
    }
   $fp = fsockopen('localhost', 25, $errno, $errstr, 5);
    if (!$fp) {
        echo('port 25 is closed or blocked.');
    } else {
        echo('port 25 is open and available');
        fclose($fp);
    }
   $fp = fsockopen('localhost', 587, $errno, $errstr, 5);
    if (!$fp) {
        echo('port 587 is closed or blocked.');
    } else {
        echo('port 587 is open and available');
        fclose($fp);
    }
   $fp = fsockopen('localhost', 465, $errno, $errstr, 5);
    if (!$fp) {
        echo('port 465 is closed or blocked.');
    } else {
        echo('port 465 is open and available');
        fclose($fp);
    }

回复显示:

port 80 is openand available
Message: fsockopen(): unable to connect to localhost:25 (Connection timed out)
Message: fsockopen(): unable to connect to localhost:587 (Connection timed out)
Message: fsockopen(): unable to connect to localhost:465 (Connection timed out)