[英]connection time out issue when sending email for codeigniter
I have a issue when sending email to codeigniter. 将电子邮件发送到codeigniter时出现问题。
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.gmail.com',
'smtp_port' => 465,
'smtp_user' => 'email@gmail.com',
'smtp_pass' => 'xxxxx',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->to($user['company_email']);
$this->email->from('noreply@email.com', 'COMPANY');
$this->email->subject('Password reset');
$this->email->message('You have requested a code. Here is your code: '. $reset['return_pass']);
$this->email->send();
At some time, I can send email with no problem but if I use it multiple times or multiple user use this send email(for forgot password), googlemail is unable to connect to ssl://smtp.googlemail.com:465 (Connection timed out) and the email will not be received by the user. 有时,我可以毫无问题地发送电子邮件,但是如果我多次使用它或多个用户使用此发送电子邮件(用于忘记密码),则googlemail无法连接到ssl://smtp.googlemail.com:465(连接超时),用户将不会收到该电子邮件。 How can I fix this issue ?
如何解决此问题? is this a security issue with googlemail?
这是googlemail的安全问题吗?
I had a similar issue. 我有一个类似的问题。 First, check the junk mail because as I was testing mine Google decided that they were junk and started sorting them in there.
首先,检查垃圾邮件,因为在我测试我的垃圾邮件时,Google判定它们为垃圾邮件,并开始在其中进行分类。
I found that the sending mail using this protocol to multiple users was very unreliable, so I simply ran a loop to send the mails: 我发现使用此协议向多个用户发送邮件非常不可靠,因此我只运行了一个循环来发送邮件:
function sendEmail($user){
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.gmail.com',
'smtp_port' => 465,
'smtp_user' => 'email@gmail.com',
'smtp_pass' => 'xxxxx',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->to($user);
$this->email->from('noreply@email.com', 'COMPANY');
$this->email->subject('Password reset');
$this->email->message('You have requested a code. Here is your code: '.
$reset['return_pass']);
$this->email->send();
}
$users = array("person1@test.com", "person2@test.com");
foreach($users as $user){
sendMail($user);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.