forget password not working in laravel 5 - laravel-5

I tried to click on link forget password and it says email has been sent but I didn't receive email
I am using gmail smpt in db config
I have already tried to change the setting in .env file but still nothing
This is mail config
MAIL_DRIVER=mail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=username#gmail.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=ssl
This isn't working it only says email has been sent but I didn't receive mail
I have also allowed in gmail to use Allow less secure apps: ON
so that app can directly send mail

You said you are using smpt driver. but in configuration you have set to mail.
So, you need to set MAIL_DRIVER from mail to smtp as given below:
'MAIL_DRIVER=smtp`.

Which password you are using ? Is that password which you are using to get login to gmail server ?
If yes then go to Myaccount of gmail then go to sign in and security and go to App password and generate password for Mail App and use that password.
May be that works for you. Same is working for me. Also change the following settings in your .env file.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_ENCRYPTION=tls

I changed the value of MAIL_DRIVER from mail to sendmail in the .env file
MAIL_DRIVER=sendmail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=email#gmail.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=ssl
In account setting of gmail allow unsecured app to send mail works for me

Related

Failed to send message from Laravel controller

I tried to send an email from a Laravel controller, but it's showing this error. I'm not using a two step verified Gmail account. Most tutorials use the "enable less secure app" settings, but I can't enable that option in my account.
this is my env file
MAIL_MAILER=smtp
MAIL_HOST=smtp.googlemail.com
MAIL_PORT=465
MAIL_USERNAME=******
MAIL_PASSWORD=******
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=********
MAIL_FROM_NAME="${APP_NAME}"
Please use your google app password in MAIL_PASSWORD

Laravel Mail Can't Send

Failed to authenticate on SMTP server with username "#####gmail.com" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "535", with message "535-5.7.8 Username and Password not accepted```
i have got this error when sending mail.
My .env configaration is
MAIL_DRIVER=smtp
MAIL_HOST=smtp.googlemail.com
MAIL_PORT=465
MAIL_USERNAME=#####gmail.com
MAIL_PASSWORD=######
MAIL_ENCRYPTION=ssl
you need to configure .env like this
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=myemail#gmail.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
Don't forget to run php artisan config:cache after you make changes in your .env file.
NOTE:- you need to allow less secure apps from "Google Account" - https://myaccount.google.com/ - Settings - Less secure app access (Turn On)
In your case, please try to enable less secure app.
Turn turn off 2 step verification and enable less secure app (as follows)
go to gmail.com
my account
and enable
Allow less secure apps: ON

Error Expected response code 250 but got code "550", with message "550 This is a submission only port. You must authenticate before sending mail

I have the centos server with laravel setup. I am facing issue while sending email from server. My laravel version is 5.8.29 and PHP version is 7.3.6. I am using SMTP to send email. Guys please do help me out. Here are my code.
It's very strange to say that from my local setup from my system I am able to send email with same SMTP details with current project setup with same code. But some how on production server the emails are not sending. I have cross checked with swift mailer and tested with separate file for only email send and its work. But from actual environment is not work.
.env file
MAIL_DRIVER=smtp
MAIL_HOST=mail.domain.com
MAIL_PORT=587
mail_username=username
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
Email should be send from the environment file
If you want to send an e-mail via Gmail then you need to verify your Gmail account with 2 step verification and generate mail password. for verifying your Gmail account to throw this link enter link description here after verifying your account go to "security->app password" generate mail password. select app "mail" and select device "window computer" copy the generated password paste into your .env file
Your .env file show look like:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=username
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
After saving your.env file, remove project config and cache with the command
php artisan config:cache
php artisan cache:clear
For sending an email via Domain follow this link enter link description here

How to send mail with laravel through gmail smtp?

I want to make contact Us page in my website, i have successfully do it with mailtrap, but when i want to send with gmail smtp server , i receive nothing and i get no error.
this is my .env mail config :
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=myemail
MAIL_PASSWORD=my_app_password
MAIL_ENCRYPTION=ssl
and code i use to send email:
$obj=new \stdClass();
$obj->contenu=$request->input('contenu');
$obj->objet=$request->input('objet');
$obj->email=$request->input('email');
$data=array('contenu'=>$obj->contenu,'email'=>$obj->email);
Mail::send("front.contactUs",$data,function ($message) use ($obj){
$message->from($obj->email);
$message->to('salondesbelleslettres#gmail.com')
->subject($obj->objet);
});
if(count(Mail::failures())>0){
return redirect()->back()->with('error','Votre demande na pas ete soumise');
}else{
return redirect()->back()->with('success','Merci de Nous Avoir Contacté');
}
Thanks.
Need to change your .env file to 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
After completion of .env edit please enter this command in your terminal for clear cache:
php artisan config:cache
You need to generate app password, and you can use that app password in .env file.
How to generate an App password:
Go to your Google Account
On the left navigation panel, click Security.
On the Signing in to Google panel, click App passwords.
(Note: If you can't get to the page, 2-Step Verification is:
Not set up for your account,
Set up for security keys only)
At the bottom, click Select app and choose the app you’re using.
Click Select device and choose the device you’re using.
Click Generate
Follow the instructions to enter the App password (the 16 character code in the yellow bar) on your device.
Click Done.
Once you are finished, you won’t see that App password code again.
Note: You may not be able to create an App password for less secure apps.
These settings worked for me instead.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=myemail#gmail.com
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=tls
You should try this:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=youremailaddress#gmail.com
MAIL_PASSWORD=gtxajikwsqmlaqcr // your app password
MAIL_ENCRYPTION=tls

HostGator, Laravel and Email

I am configuring my Laravel app to send a welcome email, just like Jeffrey Way said at Laracasts and it works fine in Mailtrap. But when I change to HostGator, which I will use in real world, it just not work at all!
Here's some code:
MAIL_DRIVER=sendmail
MAIL_HOST=srv218.prodns.com.br
MAIL_PORT=465
MAIL_USERNAME=automatico#cepcar.com.br
MAIL_PASSWORD=******* <- obviously hidden
MAIL_ENCRYPTION=tls
Have changed the driver to SMTP, encryption to SSL, none but got no success. And the problem is that there are NO ERRORS to debug!
The following changes should solve your issue.
Set a mail from address which is same as MAIL_USERNAME.
Change your mail driver to smtp.
Change mail encryption to ssl.
MAIL_DRIVER=smtp
MAIL_HOST=srv218.prodns.com.br
MAIL_PORT=465
MAIL_USERNAME=automatico#cepcar.com.br
MAIL_PASSWORD=*******
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=automatico#cepcar.com.br
the best solution is to make the following configuration in the .env file in hostgator to be able to send the emails with the corporate emails you have to define your domain on the host
MAIL_HOST= mail.<tu_dominio> => mail.amazonventas.com
MAIL_PORT=465 => estatico
MAIL_MAILER=smtp
MAIL_HOST=mail.amazonventas.com
MAIL_PORT=465
MAIL_USERNAME=**********#amazonventas.com
MAIL_PASSWORD="*********"
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=********#amazonventas.com
MAIL_FROM_NAME="${APP_NAME}"
MAIL_DRIVER=mailgun

Resources