How to configure Laravel mail.php to use usuall mail function?

I need to send an email using the mail () php function. The fact is that I do not know how to do this :( I read somewhere that I need to change the "driver" parameter in config / mail.php to "sendmail".

by default it looks like this: 'driver' => env ('MAIL_DRIVER', 'smtp'),

Now it looks like this: 'driver' => 'sendmail',

Also tried the following: 'driver' => 'mail',

But still, the mail function does not work. Help me please. Thanks in advance)

+6
source share
5 answers

.env,

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=youremail@gmail.com
MAIL_PASSWORD="password"
MAIL_ENCRYPTION=tls

config/mail.php, :

'from' => ['address' => 'youremail@gmail.com', 'name' => 'Test'],

:

php artisan cache:clear
php artisan config:cache
php artisan cache:clear
-8

, mail() PHP, Laravel :

sendmail, .env:

MAIL_DRIVER=sendmail

, , , .

, , .

.env config/mail.php:

'sendmail' => env('MAIL_SENDMAIL', '/usr/sbin/sendmail -bs')

sendmail .env. sendmail_path phpinfo(), :

MAIL_SENDMAIL='/usr/sbin/sendmail -t -i'
+16

, localhost, .env ( PHP mail )

MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=25
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=null

Then update the configuration cache:

php artisan config:cache
+8
source

You must configure your mail configuration in the .env file. Here you must install all your mail driver and all the details. Plase see this documentation https://laravel.com/docs/5.0/mail

0
source

I came across this problem today. No matter what you do, don't forgetphp artisan config:cache

0
source

Source: https://habr.com/ru/post/1675285/


All Articles