I know this issue has been brought up several times but I couldn't find any solution for my problem.
Here's the MAIL part of my .env file:
MAIL_MAILER=smtp
MAIL_HOST=localhost
MAIL_PORT=25
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
[email protected]
MAIL_FROM_NAME="${APP_NAME}"
In my code the emails are sent by using the Illuminate\Support\Facades\Mail class and everything works fine.
Now when it comes to the reset password, everything seems ok except that no email is received.
I have no error in the var/log/mail.log file where it says: mail accepted for delivery
I've traced the code all the way through to the SwiftMailer send() function but I haven't found out where this problem comes from.
Can someone helps me ?
CodePudding user response:
In the localhost project use that config in the .env file:
MAIL_MAILER='smtp'
MAIL_HOST='smtp.gmail.com'
MAIL_PORT=587
MAIL_USERNAME='[email protected]'
MAIL_PASSWORD='password'
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS='[email protected]'
MAIL_FROM_NAME="${APP_NAME}"
In the server use:
MAIL_MAILER='sendmail'
MAIL_HOST='sendmail.googlemail.com'
MAIL_PORT=587
MAIL_USERNAME='[email protected]'
MAIL_PASSWORD="password"
MAIL_ENCRYPTION='tls'
MAIL_FROM_ADDRESS='[email protected]'
MAIL_FROM_NAME="${APP_NAME}"
CodePudding user response:
It will not work with Mail_Host=localhost . Please try gmail smtp server using these configuration.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.googlemail.com
MAIL_PORT=465
MAIL_USERNAME=ENTER_YOUR_EMAIL_ADDRESS
MAIL_PASSWORD=ENTER_YOUR_GMAIL_PASSWORD
MAIL_ENCRYPTION=ssl
also please on this "Less secure app access" option in your gmail account.