I am on Laravel 5.6 and my application working well.
I am using Gmail SMTP for mail services.
here is my .env file.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=username#gmail.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
I have already Turned ON Less secure apps in Gmail also turned ON 2 step verification.
From localhost, the mail system working like charm and I am getting all emails from Gmail SMTP.
But From Live Server, I am not getting any Emails and even there is no error popup.
My Host is a 000webhost free account because I am testing my Application.
so I read forums in 000webhost and change "SET MX RECORD " to "GOOGLE'S MX RECORD".
Now I am getting this error while sending any mail.
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/?p=WantAuthError k142sm4568022ywa.67 -
gsmtp "
Please help!
Thanks in advance.
try changing your config/mail.php to your current credentials:
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.gmail.com'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME', 'username#gmail.com'),
'password' => env('MAIL_PASSWORD', 'password'),
Please allow access to less secure app from your google account following these steps:
Go to your Google Account.
On the left navigation panel, click Security.
On the bottom of the page, in the Less secure app access panel, click Turn on access.
If you don't see this setting, your administrator might have turned off less secure app account access.
Related
I have an issue with authentication while sending mail with Laravel smtp driver.
.env file:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=account#gmail.com
MAIL_FROM_ADDRESS=account#gmail.com
MAIL_PASSWORD=app_password
MAIL_ENCRYPTION=tls
It gives the following error:
"530-5.7.0 Authentication Required. "
2-Factor auth is enabled and app password is used;
Also tried with SSL on 465, same error;
Config is flushed every time .env is changed;
Everything in config/mail corresponds to .env;
SO all typical solutions are not working. What else may cause this problem?
I have also tried using smtp.vivaldi.net with vivaldi account, it authenticates, but gives an error:
"no valid recipients"
while recipient email is surely valid, which is also strange for me.
I've stumbled across this multiple times already, hence I do not remember the exact error-message which I received but here is my assumption.
Google has an option called "less secure apps" which you need to enable in order to send directly mails through their SMTP interface. Can you check if this flag is disabled and try to enable it?
https://support.google.com/a/answer/6260879
In addition to that google is slowly deprecating this feature. Starting from Mid 2020 you'll be not able to enable this flag anymore and they will completely remove this in 2021.
Reference: https://gsuiteupdates.googleblog.com/2019/12/less-secure-apps-oauth-google-username-password-incorrect.html
Firstly, you need to setup 2 step verification here google security.
An App Password link will appear and you can get your App Password to insert into below "MAIL_PASSWORD". More info on getting App Password here
MAIL_DRIVER=smtp
MAIL_FROM_ADDRESS=noreply#talhaf.com
MAIL_FROM_NAME=System
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=YOUR_GMAIL#gmail.com
MAIL_PASSWORD=YOUR_GMAIL_CREATED_APP_PASSWORD
MAIL_ENCRYPTION=tls
Don't forget to clear cache with :
php artisan config:cache
Problem was that I messed up with config/mail.php.
I wrote
'username' => env('email'),
'password' => env('app_password'),
Instead of
'username' => env('MAIL_USERNAME','email'),
'password' => env('MAIL_PASSWORD','app_password'),
I am building laravel project, I used mailgun to send emails. Locally it worked just fine. After deploying on heroku it does not send any emails.
services.php
'mailgun' => [
'domain' => env('sandbox.....'),
'secret' => env('key-.......'),
mail.php
driver' => env('MAIL_DRIVER', 'mailgun'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'example#example.com'),
'name' => env('MAIL_FROM_NAME', 'shop'),
],
'encryption' => env('MAIL_ENCRYPTION', ''),
Tried looking at heroku logs but cannot see anything about mail so I dont really understand it. What could I be missing?
I had the same issue when deploying my app. I came up with following checkpoints so it works on production with Heroku. My bet for your issue is number 4.
Make sure you have set verified domain correctly (mailgun -> domains -> verified domains & dns - all green).
Make sure you updated env variables in Heroku to work with verified domain (heroku -> settings -> reveal config vars) should have fields: MAILGUN_API_KEY, MAILGUN_DOMAIN, MAILGUN_SMTP_PASSWORD, MAILGUN_SMTP_LOGIN, MAILGUN_SMTP_SERVER, MAILGUN_SMTP_PORT with proper values.
Make sure you have cleared the list of authorized recipients (mailgun -> domains -> authorized reciepients) - so everyone can receive your emails.
Make sure you have cleared the list of IP whitelist (mailgun -> account overview -> account settings -> security -> IP whitelist) or included ip of your Heroku app. Note this point is not about IP management for domain but for your mailgun account.
In my case the only ip there was my localhost ip (for dev) and it was blocking Heroku deployed app for sending emails.
I search the stackoverflow but couldn't find any solutions that can solve the problem.
Let me mention first that PHP built-in mail() function is working properly.
This problem occurred when I tried to send reset link from /password/reset page of Laravel 5.2 Auth.
First the error message:
Swift_TransportException: Expected response code 250 but got code
"550", with message "550 Missing internal data in the header. Message
discarded."
.env file settings
MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=25
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
config/mail.php
'from' => ['address' => 'no-reply#domain.com', 'name' => 'Password Reset'],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
Hope you guys get the point. Let me know if I need to provide anything else other than above information.
I do not know whether the issue is still topical. But, according to this topic on Laracasts, try first to test the sending of the mail through the mailtrap.
For me it works for the default configuration of config/mail.php and such .env:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=secret000un
MAIL_PASSWORD=secret000pw
MAIL_ENCRYPTION=null
Of course, you must write your own accesses from the working mailbox on the mailtrap.
You should get a standard Laravel letter to reset your password.
I have mandrill configured for sending emails. Recently it stopped working so I tried to login to the mandrill account to find the following notice. I checked the MailChimp account and it was linked but still nothing is working. I have followed the documentation for sending using SwiftMailer but still nothing works.
In the documentation, it was stated to use MANDRILL_USERNAME and MANDRILL_PASSWORD. Are these the SMTP credentials is the account. If not, where can I find them in order to double check all configurations?
I'm using mandrill without problems but i have configured the service with a key to send emails.
This is how i do it:
Please check you have this in your .env:
MAIL_DRIVER=mandrill
MANDRILL_SECRET=kOAYRloydIXXXXXXXXXXXxxx
Next check your config/services.php
'mandrill' => [
'secret' => env('MANDRILL_SECRET'),
],
And your config/mail.php
'driver' => env('MAIL_DRIVER', 'mailgun'),
Hope this helps.
I would like to automate sending few emails using Live Connect API.
I had been looking at this page here from the Live Connect SDK and i found is this :
http://msdn.microsoft.com/en-ca/library/hh243646.aspx : it is stating exactly :
wl.imap The wl.imap scope enables read and write access to a user's
email using IMAP, and send access using SMTP
I wanted to use that scope to use the smtp send email right, Im able to get the access token however there is no doc about how to communicate with smtp server etc...
You can follow this example that is for gmail:
http://www.chargenevier.com/2013/02/google-smtp-and-oauth2-authentication/
For outlook you need change this:
$config = array('ssl' => 'tls', 'port' => '587', 'auth' => 'oauth2', 'xoauth2_request' => $initClientRequestEncoded);
$transport = new Zend_Mail_Transport_Smtp('smtp-mail.outlook.com', $config);