I am getting the following error when i reset password in laravel 5.4
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 s7sm7398940pgb.53 - gsmtp
"
I have correctly entered the username and password aswell as tls and smtp.gmail.com in my env. file.My mail.php file also has the correct credentials.
As for the gmail side of things:My security settings have been set to allow this to work by changing my security settings:Switching on Access for less secure apps.
And my local server,xampp has been sending emails back and forth between all the content management systems ive ever worked on for the past 2 years.I am using laravel 5.4 for the first time.
Heres my .env file
APP_NAME=MyApp
APP_ENV=local
APP_KEY=base64:---------=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=mydb
DB_USERNAME=root
DB_PASSWORD=mypwd
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=myemail#gmail.com
MAIL_PASSWORD=myemailpwd
MAIL_ENCRYPTION=tls
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PAYPAL_MODE=
PAYPAL_SANDBOX_CLIENT_ID=
PAYPAL_SANDBOX_SECRET=
PAYPAL_LIVE_CLIENT_ID=
PAYPAL_LIVE_SECRET=
And heres my mail.php
<?php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.gmail.com'),
'port' => env('MAIL_PORT', '587'),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'myemail#gmail.com'),
'name' => env('MAIL_FROM_NAME', 'myname'),
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
/*
|--------------------------------------------------------------------------
| SMTP Server Username
|--------------------------------------------------------------------------
|
| If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on
| connection. You may also set the "password" value below this one.
|
*/
'username' => env('myemail#gmail.com'),
'password' => env('myemailpwd'),
'sendmail' => '/usr/sbin/sendmail -bs',
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
Change this in your config/mail.php
'username' => env('MAIL_USERNAME', 'fallback email'),
'password' => env('MAIL_PASSWORD', 'fallback password'),
The first param is used for the key as it is defined in your .env, the second one is the default value in case the env('KEY') returns null.
The problem is right now it searches for the key 'myemail#gmail.com' in your .env file, which does not exist, the key name is 'MAIL_USERNAME'.
Related
When i run the code i got error "Failed to authenticate on SMTP server with username "hello#gmail.com" using 3 possible authenticators. Authenticator CRAM-MD5 returned Expected response code 235 but got code "535", with message "535 5.7.0 Invalid login or password ". Authenticator LOGIN returned Expected response code 250 but got an empty response. Authenticator PLAIN returned Expected response code 250 but got an empty response."
config/mail.php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.mailtrap.io'),
'port' => env('MAIL_PORT', 2525),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello#gmail.com'),
'name' => env('MAIL_FROM_NAME', 'Hello'),
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
'log_channel' => env('MAIL_LOG_CHANNEL'),
];
.env file is
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=hello#gmail.com
MAIL_PASSWORD=****
MAIL_ENCRYPTION=tls
do it like this in your env:
MAIL_DRIVER=sendmail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=***
MAIL_PASSWORD=***
MAIL_ENCRYPTION=tls
Turn on Less secure app access
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=yourmail#gmail.com
MAIL_PASSWORD=yourgmailpassword
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=yourmail#gmail.com
Each port uses a different protocol, errors like the one you had can be caused by the protocol mismatch.
Change your SMTP port to 25 or 465 or 587 or 2525 in .env file,
Save and restart the server by php artisan serve.
I'm trying to send email using laravel 5.4 but I'm getting this error.
I try to enable less secure application for my account but nothing seems to work for me. this is my code:
use Mail;
class UserController extends Controller{
public function register(Request $request)
{
$inputs=$request->all();
$data=$inputs;
Mail::send('mail.ajout', $data, function($message) use ($data)
{
$message->from($data['email']);
$message->subject("Nouvelle inscription");
$message->to('myaccount#gmail.com');
});
}
}
my env file:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_USERNAME= myacount#gmail.com
MAIL_PASSWORD= mypwd
MAIL_ENCRYPTION=tls
mail.php
<?php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello#example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
any help please ,thanks in advance
Is there space in after .env variable = ? Then just remove it takes space as a character.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_USERNAME=myacount#gmail.com
MAIL_PASSWORD=mypwd
MAIL_ENCRYPTION=tls
After changing .env clear your config and restart your server.
php artisan config:clear
php artisan serve
I would like to send a emai to a gmail address using Laravel 5.4 and Mailtrap while working on my localhost:8888.
I've got this error Swift_TransportException in AbstractSmtpTransport.php line 383:
Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required
I tried
Using different port
php artisan config:clear
What is wrong ?
.env
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=465
MAIL_USERNAME=xxxxx
MAIL_PASSWORD=xxxxx
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=example#example.com
MAIL_FROM_NAME=Leo
config/mail.php
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.mailtrap.io'),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello#example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
'username' => env('xxxxx'),
'password' => env('xxxxx'),
I needed to change
'username' => env('xxxxx'),
'password' => env('xxxxx'),
to
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
The below code (in .env file) solved my problem in sending verification
email - Laravel 5.7. No need to change in config/mail.php
MAIL_DRIVER=smtp
MAIL_HOST=mail.somedomain.org
MAIL_PORT=465
MAIL_USERNAME=someone#somedomain.org
MAIL_PASSWORD=your_pwd
MAIL_ENCRYPTION=SSL
MAIL_FROM_ADDRESS=someone#somedomain.org
MAIL_FROM_NAME=SenderName
When I try to send an email from my laravel site I get this error
Swift_TransportException in StreamBuffer.php line 268: Connection could not be established with host lin01.hkdns.co.za [ #0]
all my details is right. my env
MAIL_DRIVER=smtp
MAIL_HOST=lin01.hkdns.co.za
MAIL_PORT=465
MAIL_USERNAME=info#mysite.co.za
MAIL_PASSWORD=password
MAIL_ENCRYPTION=ssl
In my mail.php
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'info#mysite.co.za'),
'name' => env('MAIL_FROM_NAME', 'Info'),
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
Did I miss something or is this a problem on my server?
Sometime it's possible to be "cache" in the laravel.
Use this command and try again:
php artisan config:clear
If not work, try to restart you xampp.
Another option to check if the problem is with your host or your configuration is to use a Gmail server to send a test email.
Puts this in your .env
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=myemail#gmail.com
MAIL_PASSWORD=apppassword
MAIL_ENCRYPTION=tls
Create or use any gmail account and enable the less secure apps more information here
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 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 (or restart your server).
Source here
I am new in laravel framework and I have no idea on how to view my saved data in laravel. I already edited the .env to the correct values
APP_ENV=local
APP_DEBUG=true
APP_KEY=base64:YfTvtpSEf86ZR0K+MiruFqbIrmfYzMUVT4XWtj5ovLM=
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=application
DB_USERNAME=admin
DB_PASSWORD=admin
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
am I doing something wrong? whenever i try to manipulate the database in my code it says SQLSTATE[HY000] [1045] Access denied for user 'homestead'#'localhost' (using password: YES). for user "homestead"? but I already set the username into admin in my DB_USERNAME i'm so confused. Any help would be much appreciated. Thank you.
Fixed it :D Just needed to restart my laravel server. maybe its some caching issue.
Execute the following command:
composer dump-autoload -o
and also please restart your laravel application
or please check config/database.php
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'application'),
'username' => env('DB_USERNAME', 'admin'),
'password' => env('DB_PASSWORD', 'admin'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
]