CodeIgniter send SMTP Gmail

You only need to specify your Gmail email address (smtp_user) and password (smtp_pass). $this->email->send(); If you notice that the emails are sent to the spam folder, use Encrypt Class in CodeIgniter to solve this issue in Gmail.

CodeIgniter send SMTP Gmail

I have used a test Gmail account for non-production CodeIgniter email testing, but when I deploy to the production server I use the ENVIRONMENT constant to detect the correct mail connection settings.

For Gmail, I found these configuration settings (which I have put in /application/config/email.php) work fine:

    $config = Array(
      'protocol' => 'smtp',
      'smtp_host' => 'ssl://smtp.googlemail.com',
      'smtp_port' => 465,
      'smtp_user' => '<test-account-name>@gmail.com',
      'smtp_pass' => '<test-account-password>',
    );