【问题标题】:Codeigniter 1and1 emailCodeigniter 1and1 电子邮件
【发布时间】:2015-10-08 05:49:39
【问题描述】:

我在通过 SMTP 访问 1and1 电子邮件时遇到问题,他们在他们的网站上声明应将以下信息用于 SMTP

Outgoing (SMTP) Server  smtp.1and1.com
Outgoing port with TLS enabled  587
Outgoing server requires authentication?    Yes

但是,当我在 codeigniter 的电子邮件配置文件中使用它时,我从以下配置中没有得到任何结果:

$config['protocol'] = "smtp";
$config['smtp_host'] = "smtp.1and1.com";
$config['smtp_port'] = "587";
$config['smtp_user'] = "noreply@domain.com";
$config['smtp_pass'] = "noreply";
$config['smtp_crypto'] = 'tls';


$config['charset'] = 'utf-8';
$config['mailtype'] = 'html';
$config['wordwrap'] = TRUE;

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

此外,电子邮件调试函数返回:

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.

【问题讨论】:

标签: php codeigniter email


【解决方案1】:
$config1and1 = array(
            'protocol' => 'smtp',
            'smtp_host' => 'smtp.1and1.es',
            'smtp_port' => 587,
            'smtp_crypto' => 'tls',
            'smtp_user' => 'your full email', //example: jujo@domain.com
            'smtp_pass' => 'mail pass',
            'mailtype' => 'html',
            'charset' => 'utf-8',
            'newline' => "\r\n"
        );

如果您不想要邮件类型 html 可以选择其他类型。我希望对它有所帮助;)

【讨论】:

  • 必须设置这里列出的所有参数。
【解决方案2】:

codeigniter 似乎存在问题,TLS 方面需要更多工作,我最终使用了 github.com/ivantcholakov/codeigniter-phpmailer

这个库易于安装和快速运行。

【讨论】:

    【解决方案3】:

    问题在于行

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

    '\r\n' 应该写在双引号中。

    所以这条线应该是

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

    希望这行得通。

    【讨论】:

      【解决方案4】:

      你试过了吗?

      $config['smtp_port'] = 587;
      

      没有引号。

      使用 qoutes 你传递一个字符串,不带引号一个整数

      【讨论】:

      • 可悲的是,引用并没有太大的不同。
      猜你喜欢
      • 1970-01-01
      • 2019-05-15
      • 2018-08-06
      • 2016-05-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-02
      • 2017-12-07
      相关资源
      最近更新 更多