【问题标题】:codeigniter godaddy email sslcodeigniter godaddy 电子邮件 ssl
【发布时间】:2020-07-31 19:50:33
【问题描述】:

我厌倦了 Godaddy 以及他们缺乏让我的电子邮件正常工作的知识或解决方案。所以也许stackoverflow上的某个人有解决这个问题的办法。

我无法让我的电子邮件在具有安全 ssl 连接的 codeigniter 中工作。

不安全的解决方案有效

$config['email_config'] = [
    'email_address' => 'no-reply@domain.com',
    'owner'         => 'Owner',
    'email_owner'   => 'no-reply@domain.com',
    'charset'       => 'utf-8',
    'mailtype'      => 'html',
    'protocol'      => 'smtp',
    'smtp_host'     => 'mail.domain.com',
    'smtp_port'     => '587', // 465, 25, 587
    'smtp_timeout'  => '7',
    'smtp_user'     => 'no-reply@domain.com',
    'smtp_pass'     => 'xxx',
    'validation'    => TRUE, 
];

但我似乎无法通过 ssl 连接电子邮件。

$config['email_config'] = [
    'email_address' => 'no-reply@domain.com',
    'owner'         => 'Owner',
    'email_owner'   => 'no-reply@domain.com',
    'charset'       => 'utf-8',
    'mailtype'      => 'html',
    'protocol'      => 'smtp',
    'smtp_host'     => 'domain.com',
    'smtp_crypto'   => 'ssl',
    'smtp_port'     => '465', // 465, 25, 587
    'smtp_timeout'  => '7',
    'smtp_user'     => 'no-reply@domain.com',
    'smtp_pass'     => 'xxx',
    'validation'    => TRUE, 
];

详细信息在我的 cpanel 的邮件中提供

  • 安全 SSL/TLS 设置(推荐)
  • 用户名:no-reply@domain.com
  • 密码:使用电子邮件帐户的密码。
  • 接收服务器:domain.com
  • IMAP 端口:993 POP3 端口:995
  • 发送服务器:domain.com
  • SMTP 端口:465
  • IMAP、POP3 和 SMTP 需要身份验证。

【问题讨论】:

    标签: php email ssl codeigniter-3


    【解决方案1】:

    如果您将 $config 传递给 codeigniter 的电子邮件类,请使用类似的内容

    $config['protocol'] = 'smtp';
    $config['smtp_host'] = 'host.host.com';
    $config['smtp_user'] = 'username';
    $config['smtp_pass'] = 'pass';
    $config['smtp_crypto'] = 'tls';
    $config['smtp_port'] = 587;
    
    $config['charset'] = 'utf-8';
    $config['mailtype'] = 'html';
    $config['newline'] = "\r\n"; 
    

    然后将 $config 传递给方法

    $this->load->library('email');
    $this->email->initialize($config);
    

    如果不起作用将 [smtp_crypto] 更改为 ssl 并端口到 465

    编辑:这对于 codeigniter 3,代码 4.0.0 它的不同之处,告诉我回复

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-08-31
      • 2018-08-06
      • 2016-05-27
      • 1970-01-01
      • 2015-10-08
      • 1970-01-01
      • 2016-08-02
      相关资源
      最近更新 更多