I have Unsupported mail transport" error when send an email in laravel 9 project.
Here is my .env
MAIL_DRIVER = smtp
MAIL_HOST = smtp.gmail.com
MAIL_PORT = 587
MAIL_USERNAME = *****#gmail.com
MAIL_PASSWORD = *******
MAIL_ENCRYPTION = tls
MAIL_FROM_ADDRESS=*****#gmail.com
Here is my config/mail.php
'mailers' => [
'smtp' => [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.gmail.com'),
'port' => env('MAIL_PORT', 587),
'from' => ['address' => '*****', 'name' => '*****'],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
],
Please help me. Thanks!
i fixed my config/mail.php like this and it works.
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'auth_mode' => null,
],
Related
I use flutter for developement mobile application and in backend I use laravel, now when I try to register user then send mail I found this error in send mail.
Process could not be started [Le chemin d'acc�s sp�cifi� est introuvable.
code .env:
MAIL_DRIVER= smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=my gmail
MAIL_PASSWORD=my password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=my gmail
MAIL_FROM_NAME="${APP_NAME}"
code mail.php:
'mailers' => [
'smtp' => [
'driver' => env('MAIL_DRIVER', 'smtp'),
'transport' => 'mail',
'host' => env('MAIL_HOST', 'smtp.googlemail.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'auth_mode' => null,
],
'ses' => [
'transport' => 'ses',
],
'mailgun' => [
'transport' => 'mailgun',
],
'postmark' => [
'transport' => 'postmark',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => '/usr/sbin/sendmail -bs',
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
],
how to resolve this error and thanks.
if someone has such error in the the future i fixed it that way :
go to the file vendor\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php and comment out the code $options = []; and paste the code $options['ssl'] = array('verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true);
these are the config setting i am using and i just want to enable mailgun to run on testmode if it is not in production. any help appreciated.
'driver' => env('MAIL_DRIVER', 'mailgun'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'from' => [
'address' => env('SUPPORT', 'hello#example.com'),
'name' => env('NAME', 'Example'),
],
'username' => env('MAIL_USERNAME'),
'password' => env('PASSWORD'),
You can use ternary to set the values
'key' => $app->environment()=='production' ? 'prod_mode' : 'test_mode'
I am trying to find out why this happens.
.env
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=*******t#gmail.com
MAIL_PASSWORD=******
MAIL_ENCRYPTION=tls
mail.php
<?php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.gmail.com'),
'port' => env('MAIL_PORT', 587),
'from' => ['address' => '******#gmail.com', 'name' => 'Project'],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('******#gmail.com'),
'password' => env('******'),
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
'stream' => [
'ssl' => [
'allow_self_signed' => true,
'verify_peer' => false,
'verify_peer_name' => false,
],
],
];
This is the error
Failed to authenticate on SMTP server with username "" using 3 possible authenticators. Authenticator LOGIN returned Swift_TransportExce ▶
534-5.7.14 GVHg3-rU8SDpVLdwnIPviBCjKNnBRcxuU2N3-pcUWd0TeMbM_vULrHhQcVNXjhoewjrquW\r\n
534-5.7.14 Jttd6jNXfnledZiAMv-rjMvpnd01nas-2J2BYU_Krd4kzT-YmTR_HW9uW3S6Ts2jUxDaC8\r\n
534-5.7.14 XmT_TV9QqYXHXkTMcrX3OG9D4QyF4E6w7fwnu2bYZT36rZXTU-HqJwlWzJBv8-MC2P9xrN\r\n
534-5.7.14 cUd4-BirG0rfAjlDxy5bkbon3S_bIFSZQVd0-5wskctUR4do7F> Please log in via\r\n
534-5.7.14 your web browser and then try again.\r\n
534-5.7.14 Learn more at\r\n
534 5.7.14 https://support.google.com/mail/answer/78754 l5-v6sm1366079wrv.84 - gsmtp\r\n
" in C:\xampp\htdocs\wer\walrer\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\AbstractSmtpTransport.php:457\n
Stack trace:\n
I checked email credentials and they are the same. In this project I
have used authentication , but can't find a solution to this one.
I think there is something wrong with your mail.php file.
You should be passing the variable names to the env() function for username and password.
So this:
'username' => env('******#gmail.com'),
'password' => env('******'),
Becomes this:
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
Your .env file looks good.
You mail.php file should look like this:
<?php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.gmail.com'),
'port' => env('MAIL_PORT', 587),
'from' => ['address' => '******#gmail.com', 'name' => 'Project'],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME', '******#gmail.com'),
'password' => env('MAIL_PASSWORD', '******'),
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
'stream' => [
'ssl' => [
'allow_self_signed' => true,
'verify_peer' => false,
'verify_peer_name' => false,
],
],
];
The value in the second parameter for the env() function, gets used if the .env key specified in the first parameter is not found.
You need to enable less secure apps access at your google account for this to work
I am trying to send an email verification for the registering users but I am getting the following error:
Expected response code 250 but got code "530", with message "530-5.5.1
Authentication Required. Learn more at\r\n 530 5.5.1
https://support.google.com/mail/?p=WantAuthError v11sm5345109pgt.0 -
gsmtp\r\n
I have tried all the possible ways by enabling the "less secure" and other instructions but not understanding the error. please help me to sort out the problem.
My .env file is :
My Controller:
My mail.php:
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.gmail.com'),
'port' => env('MAIL_PORT', 587),
'from' => ['address' => env('MAIL_FROM_ADDRESS', 'myaccount#gmail.com'),
'name' => env('MAIL_FROM_NAME', 'Example'), ],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('myaccount#gmail.com'),
'password' => env('*******'),
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => FALSE,
The problem is in your mail.php, use this code instead of your
...
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.gmail.com'),
'port' => env('MAIL_PORT', 587),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'myaccount#gmail.com'),
'name' => env('MAIL_FROM_NAME', 'Example')
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME', 'myaccount#gmail.com'),
'password' => env('MAIL_PASSWORD', '*******'),
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => FALSE,
...
EDIT:
First parameter of the env() helper method is name of environment variable and second one is a fallback value if that variable isn't found. The reason why it didn't work is because Laravel wasn't able to find an environment variable under the name myaccount#gmail.com and *******.
i install guzzle for sending mail with mailgun, i create mailgun account
this is my mail.php
'driver' => 'mailgun',
'host' => 'smtp.mailgun.org',
'port' => 587,
'from' => array('address' =>'my#gmail.com','name'=>'My Name'),
'encryption' => 'tls',
'username' => null,
'password' => null,
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
and my services.php
'mailgun' => [
'domain' => 'sandboxexxxxxxxxxxxxxxxxxxxxx.mailgun.org',
'secret' => 'key-xxxxxxxxxxxxxxxxxxxxxxx',
],
but i get error, i have setting it right, but what is the problem?
ClientException in Middleware.php line 69:
Client error: 401