CodeIgniter Forums
Cannot send mail via SMTP (version 3.16) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: Cannot send mail via SMTP (version 3.16) (/showthread.php?tid=69229)



Cannot send mail via SMTP (version 3.16) - Rifky Pujiyansyah Suropaty - 10-23-2017

I cannot send mail via SMTP, i'm using gmail account in this case.
There is my config:

$config['protocol'] = 'smtp';
$config['smtp_host'] = "ssl://smtp.googlemail.com";
$config['smtp_port'] = 465;
$config['smtp_user'] = 'email';
$config['smtp_pass'] = 'password';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html';

I've tried to login gmail using my email and my password, and I can logged in.
and I've changed "Allow less secure apps" to ON , but still does not send email.


The result of debug on attached files.
Thank you


RE: Cannot send mail via SMTP (version 3.16) - enlivenapp - 10-26-2017

Google seems to be replying with a bad password or email address. Have you verified they're good?

I'm not familiar with using google's smtp but I seems to remember having to use an app specific password to log in when using two factor authentication, I'd verify that as well if you are.


RE: Cannot send mail via SMTP (version 3.16) - Rifky Pujiyansyah Suropaty - 10-27-2017

(10-26-2017, 02:19 PM)enlivenapp Wrote: Google seems to be replying with a bad password or email address.   Have you verified they're good?

I'm not familiar with using google's smtp but I seems to remember having to use an app specific password to log in when using two factor authentication, I'd verify that as well if you are.

I've tried to login normally on web, that's good

but I've tried to add third party library (phpmailer), I can send mail


RE: Cannot send mail via SMTP (version 3.16) - enlivenapp - 10-27-2017

Yeah, I got that you could login normally and phpmailer isn't working.

Try reading the error you got. "Username and password not accepted"...

Are you using two factor authentication?


RE: Cannot send mail via SMTP (version 3.16) - Rifky Pujiyansyah Suropaty - 10-27-2017

(10-27-2017, 09:29 AM)enlivenapp Wrote: Yeah, I got that you could login normally and phpmailer isn't working.

Try reading the error you got. "Username and password not accepted"...

Are you using two factor authentication?

I mean when i add "phpmailer" as third party library, i can send mail, but the included library from codeigniter i cannot send mail. I've tried 2 months a go and that is normal (on previous version not 3.16) I can send mail.

two factor authentication is off

should I turn it on?

Thank You So Much for attention and help #smile


RE: Cannot send mail via SMTP (version 3.16) - InsiteFX - 11-01-2017

If your running on a localhost you need to setup SMTP in the php.ini file.


RE: Cannot send mail via SMTP (version 3.16) - ivantcholakov - 11-01-2017

@Rifky Pujiyansyah Suropaty

If PHPMailer works, you may try this library of mine, it extends CI_Email: https://github.com/ivantcholakov/codeigniter-phpmailer
Just install it within your application and write/use your configuration data. You would not need to change your application code for sending emails, leave it as it is, in CodeIgniter style. Thus PHPMailer would do the job hidden behind the CodeIgniter's API.

Second, not mandatory: It would be better, if you try to use tls (port 587), it is a newer way encryption that is also supported by Gmail.


RE: Cannot send mail via SMTP (version 3.16) - Leo - 11-01-2017

I've had trouble with Gmail SMTP myself recently (a month ago). Everything worked fine - and then it stopped - on all my sites using SMTP Gmail. Anyway I'm using sendmail everywhere now and it works. (CI 3.1.5)