codeigniter godaddy 电子邮件 ssl
codeigniter godaddy email ssl
我受够了教父和他们缺乏知识或解决方案来让我的电子邮件正常工作。所以也许 Whosebug 上的某个人可以解决这个问题。
我无法通过安全的 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 需要身份验证。
如果您将 $config 传递给 codeigniter 的电子邮件 class,请使用类似这样的东西
$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 的不同之处,请回复我
我受够了教父和他们缺乏知识或解决方案来让我的电子邮件正常工作。所以也许 Whosebug 上的某个人可以解决这个问题。
我无法通过安全的 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 需要身份验证。
如果您将 $config 传递给 codeigniter 的电子邮件 class,请使用类似这样的东西
$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 的不同之处,请回复我