codeigniter 显示 stream_socket_client(): Failed to enable crypto this error on sendmail?
codeigniter shows stream_socket_client(): Failed to enable crypto this error on sendmail?
我正在尝试使用本地计算机上的 xampp 服务器发送带有代码点火器的电子邮件,但它无法正常工作。它向我显示了一些我在网上搜索了很多的错误,但现在我很无助,我尝试的所有解决方案对我来说都失败了。
以下是我的 3 个错误:
Message: stream_socket_client(): SSL: The operation completed successfully.
Message: stream_socket_client(): Failed to enable crypto
Message: stream_socket_client(): unable to connect to ssl://smtp.gmail.com:587 (Unknown error)
这是我的 php 代码:
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.gmail.com',
'smtp_port' => '587',
'smtp_user' => 'mygmailid@gmail.com',
'smtp_pass' => 'xxxmypassword',
'mailtype' => 'html',
'starttls' => true,
'newline' => "\r\n"
);
$message = '';
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->initialize($config);
$this->email->from('mygmailid@gmail.com');
$this->email->to('mygmailid@gmail.com');
$this->email->subject('Resume from JobsBuddy for your Job posting');
$this->email->message($message);
if($this->email->send())
{
echo 'Email sent.';
}
else
{
show_error($this->email->print_debugger());
}
在 print_debugger 我也收到这个错误:
The following SMTP error was encountered: 0
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
This is a multi-part message in MIME format.
Your email application may not support this format.
请指导我正确的解决方案。
您的电子邮件配置应如下所示:
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.gmail.com',
'smtp_port' => 465,
'smtp_user' => 'YOUR_USERNAME',
'smtp_pass' => 'YOUR_PASSWORD',
'mailtype' => 'html',
'charset' => 'utf-8',
'newline' => "\r\n",
'wordwrap' => TRUE,
);
正如 Sandeep J Patel 在他的评论中所说,您还需要在您的 gmail 帐户设置中为安全性较低的应用程序启用访问权限。
查看他们的帮助页面:https://support.google.com/accounts/answer/6010255?hl=en
我正在尝试使用本地计算机上的 xampp 服务器发送带有代码点火器的电子邮件,但它无法正常工作。它向我显示了一些我在网上搜索了很多的错误,但现在我很无助,我尝试的所有解决方案对我来说都失败了。
以下是我的 3 个错误:
Message: stream_socket_client(): SSL: The operation completed successfully.
Message: stream_socket_client(): Failed to enable crypto
Message: stream_socket_client(): unable to connect to ssl://smtp.gmail.com:587 (Unknown error)
这是我的 php 代码:
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.gmail.com',
'smtp_port' => '587',
'smtp_user' => 'mygmailid@gmail.com',
'smtp_pass' => 'xxxmypassword',
'mailtype' => 'html',
'starttls' => true,
'newline' => "\r\n"
);
$message = '';
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->initialize($config);
$this->email->from('mygmailid@gmail.com');
$this->email->to('mygmailid@gmail.com');
$this->email->subject('Resume from JobsBuddy for your Job posting');
$this->email->message($message);
if($this->email->send())
{
echo 'Email sent.';
}
else
{
show_error($this->email->print_debugger());
}
在 print_debugger 我也收到这个错误:
The following SMTP error was encountered: 0
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
This is a multi-part message in MIME format.
Your email application may not support this format.
请指导我正确的解决方案。
您的电子邮件配置应如下所示:
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.gmail.com',
'smtp_port' => 465,
'smtp_user' => 'YOUR_USERNAME',
'smtp_pass' => 'YOUR_PASSWORD',
'mailtype' => 'html',
'charset' => 'utf-8',
'newline' => "\r\n",
'wordwrap' => TRUE,
);
正如 Sandeep J Patel 在他的评论中所说,您还需要在您的 gmail 帐户设置中为安全性较低的应用程序启用访问权限。
查看他们的帮助页面:https://support.google.com/accounts/answer/6010255?hl=en