[HELP] email doesn't get sent with gmail smtp

Published 3 years ago by almazik

Hi everyone.

I'm trying to send email from my application but getting the following error: Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 http://support.google.com/mail/bin/answer.py?answer=14257 kz7sm4622758lac.10 - gsmtp "

my app/config.mail.php looks like this:


'driver' => 'smtp', 'host' => 'smtp.gmail.com', 'port' => 587, 'from' => array('address' => 'xmalinkoff@gmail.com', 'name' => 'Andrew Malinkoff'), 'encryption' => 'tls', 'username' => 'username@gmail.com', 'password' => 'my pass', 'sendmail' => '/usr/sbin/sendmail -bs', 'pretend' => false,

Any thoughts?

credentials are correct, I tried to use different ones several times

Best Answer (As Selected By almazik)
xingfucoder

You need to authorize the external application use of gmail, I think.

Follow the next steps and authorize to make it:

  • First, go to your Google Account Management page
  • Under the Security options, click Edit link of Authorizing applications & sites

Hope it helps you.

xingfucoder

You need to authorize the external application use of gmail, I think.

Follow the next steps and authorize to make it:

  • First, go to your Google Account Management page
  • Under the Security options, click Edit link of Authorizing applications & sites

Hope it helps you.

almazik

perfect, that was it, thank you

almazik

Well, it worked on local environment, but not going to on forge... Getting the same error

xingfucoder

May be you need to create a token for use within forge.

Any forge user maybe help in a better way.

arabsight

you can allow less secure apps from you settings in gmail, go to:

https://www.google.com/settings/security/lesssecureapps

and set 'Access for less secure apps' to "Enabled"

almazik

@arabsight yes, thanks, I have already done it..

JillzTom

Best solution is to use http://mandrill.com/
You don't have to compromise with your Gmail security. Every Mandrill account comes with 2,000 free trial sends.

muragijimana

Why can you buy service while there is other free service please explain to me?

stevewolfe555

Hi,

Just change your 'driver' => 'smtp', to 'driver' => 'sendmail',

All configurations are correct. Just need to change driver 'smtp' to 'sendmail'. It's working.

For copy paste ;)

'driver' => 'sendmail', 'host' => 'smtp.gmail.com', 'port' => 587, 'from' => array('address' => '[email protected]', 'name' => 'Andrew Malinkoff'), 'encryption' => 'tls', 'username' => '[email protected]', 'password' => 'my pass', 'sendmail' => '/usr/sbin/sendmail -bs', 'pretend' => false,

lucasmartins

Hi @stevewolfe555 , Thankyou very much!

I changed the driver to 'sendmail' and it worked.

But the emails are falling in the spam box, do you know about it?

Regards, Lucas Martins.

SandrineCC

Hi And thanks a lot @stevewolfe555! Modified in 2 sec and it worked !

Jaime48

@stevewolfe555 ,you are a genius, what should I do to repay you, a blow job?

rinkesh-prajapat

Error is:- stream_socket_enable_crypto():

SSL operation failed with code 1. OpenSSL Error messages:

error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed

Please sign in or create an account to participate in this conversation.