Error when sending email via Laravel 5.1 - php

When I try to send an e-mail through my website running Laravel 5, I get this exception:
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 https://support.google.com/mail/answer/14257 l140sm14142372oig.11 - gsmtp
Here is my env configuration
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=example#gmail.com
MAIL_PASSWORD=example
MAIL_ENCRYPTION=tls
Code works on local and other website but not work on my new website on new hosting. I allow access from less-secure apps. What can be problem?

It's possible that G-Mail doesn't like the 3rd party application that's connecting to it.
If you are sure the credentials are correct, then visit this link to check if you need to approve the application

Related

MailGun returning error 421 on Laravel Application

I have a free tier account on MailGun and I'm trying to configure the application to send the user a token to reset his password but I keep getting the following error in my browser console.
"Expected response code "220" but got code "421", with message "421 Server busy, too many connections".
This is how my .env file is configured
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
MAIL_USERNAME=postmaster#sandbox6xxxxxxxxxxxxxxx.mailgun.org
MAIL_PASSWORD=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
MAIL_ENCRYPTION=tls
Why are you using the smtp config? Laravel comes with a Mailgun driver built in. You should be setting your MAILER to mailgun and then configuring your mailgun domain, key, and email address.
See here: https://laravel.com/docs/9.x/mail#mailgun-driver

Failed to authenticate on SMTP server in Laravel 6

I am trying to use smtp email functionality in my Laravel 6 Application.
This is my .env file code :
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=******#gmail.com
MAIL_PASSWORD=******
MAIL_ENCRYPTION=tls
Here it is the funny part :
It is working fine in my local host
It is also working in my server (without http)
It stopped working when I applied https in my server.
It gives me below error :
Failed to authenticate on SMTP server with username "*********#gmail.com" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "534", with message "534-5.7.14
534-5.7.14 Please log in via your web browser and then try again.
534-5.7.14 Learn more at
534 5.7.14 https://support.google.com/mail/answer/78754 g6sm37628450pja.2 - gsmtp
". Authenticator PLAIN returned Expected response code 235 but got code "534", with message "534-5.7.14
534-5.7.14 Please log in via your web browser and then try again.
534-5.7.14 Learn more at
534 5.7.14 https://support.google.com/mail/answer/78754 g6sm37628450pja.2 - gsmtp
". Authenticator XOAUTH2 returned 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 https://support.google.com/mail/?p=BadCredentials g6sm37628450pja.2 - gsmtp
".
Note :
Allow less secure logged is enabled
This same email is not used in three application for the SMTP email functionality.
the email is working in localhost, the less secure account account verification is correct
But you can't use your email in more than 3 projects, so you should stop using this email on other accounts.
Check if your gmail password has the $ character, if so change it.
it worked for me

How send email with laravel ... i need send to gmail

I need send email with laravel to gmail but it's showing the below error:
Error:
Expected response code 250 but got code "530", with message "530 5.7.0
Must issue a STARTTLS command first. 127sm105612220wmm.45 - gsmtp "
First login to your Gmail account and under My account > Sign In And Security > Sign In to google, enable two step verification, then you can generate app password, and you can use that app password in .env file.
Your .env a file will then look something like this:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=myemail#gmail.com
MAIL_PASSWORD=apppassword
MAIL_ENCRYPTION=tls
Don't forget to run php artisan config:cache after you make changes in your .env file.
Response code 530 indicates that you have not allowed Less Secure Apps to use your Gmail account.
You will need to enable this in your Google settings. Here's a link.
After you have allowed this, the email should go through.
If you're just testing, I would recommend using an SMTP testing server, such as Mailtrap. It's free and will avoid the security risk that comes with allowing less secure apps to use your Gmail account.
Please turn on Less secure app access for your SMTP email account.
From the following url go to: Google Account

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

I am using laravel 5.4.
While sending verification email, i got the aforementioned error.
I don't know what i am doing wrong this is my env file:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=shahzadshah5741#gmail.com
MAIL_PASSWORD=hussain57421
MAIL_ENCRYPTION=tls
Two ways:
Go to your Google Account Management page
Under the Security options, click Edit link of Authorising applications & sites
Under gmail settings, you need to access https://www.google.com/settings/security/lesssecureapps
and set 'Access for less secure apps' to "Enabled"

Sending email in heroku host since laravel 5.4

I am trying to send an email confirmation account from a web application made in laravel 5.4, I have tested in my localhost and it is sent correctly, but when deployed in heroku throws me this error:
Swift_TransportException in AbstractSmtpTransport.php line 383:
Expected response code 250 but got code "530", with message "530-5.5.1
Authentication Required.
Learn more at
530 5.5.1 https://support.google.com/mail/answer/14257 w10sm15831823wjk.18 -
gsmtp"
I have already configured the application key from gmail, even the tests from the localhost are positive, but since heroku fails to send the email.
These are my settings in the .env file:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=micorreo#gmail.com
MAIL_PASSWORD=mvallokmzmszjtwk
MAIL_ENCRYPTION=tls
You have to configure add-on mail in heroku https://devcenter.heroku.com/articles/smtp

Categories