【问题标题】:Issues with Google SMTP and CodeIgniterGoogle SMTP 和 CodeIgniter 的问题
【发布时间】:2012-02-02 17:52:53
【问题描述】:

我看到很多其他人都有这个问题。

我已经使用 Google Mail 服务器设置了一个电子邮件表单来发送电子邮件。这在我的本地机器上工作,但是一旦我把它放在服务器上,我就会收到这个错误

The following SMTP error was encountered: 110 Connection timed out
Unable to send data: AUTH LOGIN
Failed to send AUTH LOGIN command. Error:
Unable to send data: MAIL FROM:

from: 

The following SMTP error was encountered:
Unable to send data: RCPT TO:

to: 

The following SMTP error was encountered:
Unable to send data: DATA

data: 

The following SMTP error was encountered:
Unable to send data: User-Agent: CodeIgniter Date: Thu, 2 Feb 2012 14:24:43 +0000


这是我在 CI 中的设置

$config = array (
    'smtp_host' => 'ssl://smtp.googlemail.com',
    'smtp_user' => 'emial',
    'smtp_pass' => 'password',
    'smtp_port' => '465',
    'protocol' => 'smtp',
    'charset'  => 'utf-8',
    'mailtype' => 'html',
    'wordwrap' => TRUE
);


我尝试过同时使用 port465 和 587,以及 ssl://smtp.googlemail.com 和 tls://smtp.googlemail.com

任何帮助让这个工作会很棒。

【问题讨论】:

  • 您可能想尝试解决方案posted here
  • 谢谢,但这就是我所拥有的,我没有 fsockopen 问题,它可能与端口有关。
  • 我不确定这有多重要,但我注意到 charset 不同。
  • 嗨科林,如果我删除“html”,它似乎只会发送文本。不知道为什么,但它有效......

标签: codeigniter smtp gmail


【解决方案1】:

将以下行添加到您的电子邮件配置中:

$config['newline'] = "\r\n";

【讨论】:

  • 感谢@WebNovice 会注意到这一点!
【解决方案2】:

我认为最好不要更改框架的核心文件。

就我而言

$config['newline'] = "\r\n";

没用,但添加了

$this->email->set_newline("\r\n");

发送电子邮件的方法以某种方式完成了工作。

【讨论】:

    【解决方案3】:

    我遇到了类似的问题,我可以通过将 system/libraries/Email.php 中的 $newline 更改为 \r\ntext 发送邮件

    【讨论】:

    • 谢谢@ow3n 会注意的!
    猜你喜欢
    • 2021-11-25
    • 1970-01-01
    • 1970-01-01
    • 2015-03-16
    • 2023-02-14
    • 2011-11-08
    • 1970-01-01
    • 2011-10-10
    • 1970-01-01
    相关资源
    最近更新 更多