Send email with Google account using CodeIgniter

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.


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)

<ol> <li>Set off <strong>2-step Verification</strong>.</li> <li><strong>Allow less secure apps</strong>: ON (or Enable)</li> </ol>

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

Hope this help.


  • SQL Query to store text data in a Varbinary(max)
  • Change my applications's exe file version in VB6
  • Flask can't see modules installed by pip
  • show graphite invalid lines
  • ASP.NET MVC - Check if request comes from another action
  • BPEL Designer for Eclipse: how to debug a BPEL process
  • Securely storing (encrypting) data in an ASP.Net application
  • Confusing SQL error in SELECT NULL, *, NULL, NULL
  • How to escape colon (:) character while executing native SQL queries against an Informix database us
  • How to extract a number from a string [duplicate]
  • How to best manage SMTP clients
  • Swift iOS don't recognize GCM library imports?
  • INSERT EXEC Statement cannot be nested [duplicate]
  • Javascript focus remove text highlight
  • Get used tables from sql query [duplicate]
  • Efficient User-Agent Regex to find Safari in Python
  • Multiple producers single consumer locking schema
  • Tell Git to stop prompting me for conflicts when none really exist?
  • pillow imaging ImportError
  • Check for zero lines output from command over SSH
  • nonblocking BIO_do_connect blocked when there is no internet connected
  • Declaring variable dynamically in VB.net
  • MailKit: The IMAP server replied to the 'EXAMINE' command with a 'BAD' response
  • Typescript - Unable to get 'import' statement to function
  • Exchange data b/w iOS devices using Bluetooth 4.0
  • Running a C# exe file
  • Can a Chrome extension content script make an jQuery AJAX request for an html file that is itself a
  • Display Images one by one with next and previous functionality
  • How to make Safari send if-modified-since header?
  • Upload files with Ajax and Jquery
  • Apache 2.4 - remove | delete | uninstall
  • How to pass list parameters for each object using Spring MVC?
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Unit Testing MVC Web Application in Visual Studio and Problem with QTAgent
  • AngularJs get employee from factory
  • Proper way to use connect-multiparty with express.js?
  • Benchmarking RAM performance - UWP and C#
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • JaxB to read class hierarchy
  • Running Map reduces the dimensions of the matrices