Send email with Google account using CodeIgniter

会有一股神秘感。 提交于 2019-12-11 03:07:45

问题


I'm trying to send emails with CodeIgniter using smtp.googlemail.com. No problems with code but Google is preventing me from sending that email - here's the email I received on my Google account:

A third party recently tried to use an application to connect to your Google account.

We blocked the connection attempt in case it would be a hacker trying to access your account.

If you have not made ​​this connection attempt, it may mean a third party is trying to access your account. We recommend that you log into your account and reset your password immediately. We blocked the connection attempt in case it would be a hacker trying to access your account.

If this is your account and if you are having trouble to get there, follow the troubleshooting procedure explained at http://support.google.com/mail?p=client_login.

I have followed the link and didn't find a solution.


回答1:


I have the same issue, got an email from Google saying "Sign-in attempt prevented" when I was trying the same. I am ignoring what you have received from google and the text of email. Finally I solved the issue to send mail using CodeIgniter Email library today.

To use Google SMTP in CodeIgniter you need to make 2 (two) changes into Gmail account setting: (N.B. Please be aware that it is now easier for an attacker to break into your account -says Google)

  1. Set off 2-step Verification.
  2. Allow less secure apps: ON (or Enable)

Now use 'smtp_host' as ssl://smtp.gmail.com instead of smtp.googlemail.com

Hope this help.



来源:https://stackoverflow.com/questions/17909913/send-email-with-google-account-using-codeigniter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!