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.
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 developping a complex website but when I try to deploy it I got an error whenever the website needs to send an email (for the email validation system, built-in with Laravel). The error I got is:
[ErrorException (E_NOTICE)] Undefined offset: 3
The exception seems to be thrown from /vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php.
The only changes I made to config/mail.php is to allow self-signed certificates for ssl. My .env file contains these lines:
MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=25
MAIL_USERNAME=myusername //match in real file
MAIL_PASSWORD=mypassword //match in real file
MAIL_FROM_ADDRESS=from#mydomain.stackoverflow
MAIL_FROM_NAME=MyAppName
MAIL_ENCRYPTION=tls
My mail server is on the same server (as you could guess with MAIL_HOST=localhost) and is running postfix with Dovecot. I'm also using a webmail app (roundcube) to use my mail server and it works fine (except for OpenDKIM which doesn't sign outcoming mails).
Do you have any idea where my problem can come from?
EDIT: It works with Mailtrap.io so the problems should come fromp the configuration but I don't know if it comes from my Postfix config or from my Laravel config
EDIT2: I still don't understand why but removing credentials works fine. It works with credentials but only if I remove the MAIL_ENCRYPTION option (setting it to null). So here is the working config I have:
MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=587
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS=from#mydomain.stackoverflow
MAIL_FROM_NAME=MyAppName
MAIL_ENCRYPTION=tls
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.
I am trying to set up mail sending with mailgun on my deployed laravel application. I am able to send email verification emails, but I can't send to my email. For example:
Notification::route('mail', 'admin#mywebsite.org')
->notify(new Feedback($user->email, $subject, $message));
When I was using mailtrap.io to test my mail sending it worked perfectly.
My .env file looks like this:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
MAILGUN_SECRET=key-<key>
MAIL_USERNAME=postmaster#sandbox<somenums>.mailgun.org
MAIL_PASSWORD=<mypass>
MAIL_ENCRYPTION=tls
When I try to send the email it brings this error: Expected response code 250 but got code "554", with message "554 Sandbox subdomains are for test purposes only. Please add your own domain or add the address to authorized recipients in Account Settings. "
welcome to SO.
Please have a deeper look at the Laravel official documentation where you can find everything you need to set up the mailgun driver.
Mailgun Driver
To use the Mailgun driver, first install Guzzle, then set the driver option in your config/mail.php configuration file to mailgun. Next, verify that your config/services.php configuration file contains the following options:
'mailgun' => [
'domain' => 'your-mailgun-domain',
'secret' => 'your-mailgun-key',
],
After updating your conf you have to change the MAIL_DRIVER env variable from smtp to mailgun. All the other settings for username, password and so on are not required.
I am wondering how to setup namcheap and maligun to receive emails. Currently I am able to send emails with my laravel application through maligun, but I am not sure how to setup maligun to receives replies?
I have seen the options of setting up routes to receive emails to some wanted enpoint, but currently I am not receiving anything on maligun, so I have nothing to forward. I am getting the message:
This is the mail system at host eforward3e.registrar-servers.com.
I'm sorry to have to inform you that your message could not be
delivered to one or more recipients. It's attached below.
For further assistance, please send mail to postmaster.
If you do so, please include this problem report. You can delete your
own text from the attached returned message.
The mail system
: unknown user:
"support#my-domain.com"
Final-Recipient: rfc822; support#my-domain.com
Original-Recipient: rfc822;support#my-domain.com Action: failed
Status: 5.1.1 Diagnostic-Code: X-Postfix; unknown user:
"support#my-domain.com"
How should I set this up?
Hope you register your domain at mailgun, if not then do it here. Once your domain register follow below steps:
1) Get domain and API Key from Mailgun > Doamins > Domain Information page
2) Setup config/services.php:
'mailgun' => array(
'domain' => 'YOURDOMAINNAME',//Place your register domain name here...
'secret' => 'API Key',//Place your API Key here...
),
3) Setup .env:
MAIL_DRIVER=mailgun
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
MAIL_USERNAME=USERNAME
MAIL_PASSWORD=YOURPASSWORD
MAIL_ENCRYPTION=tls
4) Check with sending mail from laravel application.
That's it...