【问题标题】:Send SMTP emails using Codeigniter on 1and1 host在 1and1 主机上使用 Codeigniter 发送 SMTP 电子邮件
【发布时间】:2011-10-21 15:04:13
【问题描述】:

我正在尝试通过 SMTP 在托管在 1and1 上的 codeigniter 网站上发送电子邮件。当我在本地执行此操作时效果很好,但是当我从我的 1and1 主机尝试时,我得到一个错误。

这是我的配置:

$config['protocol'] = 'smtp';
$config['smtp_host'] = 'auth.smtp.1and1.fr'; //i'm in france and this is the SMTP server adress 1and1 gave me.
$config['smtp_port'] = 25;
$config['smtp_user'] = 'user@mydomain.com';
$config['smtp_pass'] = 'password';

这是错误:

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: //details about my message i removed
Unable to send data: .

The following SMTP error was encountered:
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

然后我尝试使用 smtp.1and1.com 而不是 auth.smtp.1and1.fr。令人惊讶的是它有效,但执行需要 30 秒! (在我的本地主机上它是瞬时的)。

有什么建议吗?

【问题讨论】:

    标签: email codeigniter smtp shared-hosting


    【解决方案1】:

    与他们的支持交谈。他们可能对港口有限制。或者使用 sendmail。

    【讨论】:

      【解决方案2】:

      如果您的托管服务器和电子邮件服务器位于同一个地方,则无需进行 smtp 身份验证。

      所以从您的配置文件中删除以下代码,将所有内容保持为默认值并执行您的功能。为我工作。在这种情况下应该适合你。

      $config['protocol'] = 'smtp';
      $config['smtp_host'] = 'auth.smtp.1and1.fr'; //i'm in france and this is the SMTP server adress 1and1 gave me.
      $config['smtp_port'] = 25;
      $config['smtp_user'] = 'user@mydomain.com';
      $config['smtp_pass'] = 'password';
      

      【讨论】:

        猜你喜欢
        • 2018-08-06
        • 2019-05-15
        • 2014-08-09
        • 2015-11-10
        • 1970-01-01
        • 2018-03-23
        • 2017-02-20
        • 2015-10-08
        • 2011-08-02
        相关资源
        最近更新 更多