为什么 CI 图书馆不发送电子邮件既不显示错误
Why CI library not sending email neither showing error
我正在尝试通过 Codeigniter 电子邮件库发送电子邮件,以下是我的设置
`
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.gmail.com';
$config['smtp_port'] = '465';
$config['smtp_timeout'] = '60';
$config['smtp_user'] = 'zahoorulhaq37@gmail.com';
$config['smtp_pass'] = '****';
$config['charset'] = 'utf-8';
$config['newline'] = '\r\n';
$config['mailtype'] = 'html';
$config['validation'] = TRUE;
// bool whether to validate email or not
$this->email->initialize( $config );
$this->email->from( 'zahoorulhaq37@gmail.com' );
$this->email->to( 'zahoorulhaq37@hotmail.com' );
$this->email->subject( 'testing' );
$this->email->message( 'testingg' );
$sent = $this->email->send();
if ( !$sent ) {
echo $this->email->print_debugger();
}
echo $sent;`
但它只是超时,我既没有得到应该为真的响应,也没有得到错误
要在您的电子邮件库中显示错误,您必须将发送方法设置为 false,如下所示:
$this->email->send(false);
然后调试器就可以工作了。否则调试器没有显示。
echo echo $this->email->print_debugger();
此外,如果您使用 smtp 和 ssl 发送电子邮件,您可能需要额外的配置。
$config['smtp_crypto'] = 'ssl';
我正在尝试通过 Codeigniter 电子邮件库发送电子邮件,以下是我的设置 `
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.gmail.com';
$config['smtp_port'] = '465';
$config['smtp_timeout'] = '60';
$config['smtp_user'] = 'zahoorulhaq37@gmail.com';
$config['smtp_pass'] = '****';
$config['charset'] = 'utf-8';
$config['newline'] = '\r\n';
$config['mailtype'] = 'html';
$config['validation'] = TRUE;
// bool whether to validate email or not
$this->email->initialize( $config );
$this->email->from( 'zahoorulhaq37@gmail.com' );
$this->email->to( 'zahoorulhaq37@hotmail.com' );
$this->email->subject( 'testing' );
$this->email->message( 'testingg' );
$sent = $this->email->send();
if ( !$sent ) {
echo $this->email->print_debugger();
}
echo $sent;`
但它只是超时,我既没有得到应该为真的响应,也没有得到错误
要在您的电子邮件库中显示错误,您必须将发送方法设置为 false,如下所示:
$this->email->send(false);
然后调试器就可以工作了。否则调试器没有显示。
echo echo $this->email->print_debugger();
此外,如果您使用 smtp 和 ssl 发送电子邮件,您可能需要额外的配置。
$config['smtp_crypto'] = 'ssl';