Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

johndoee's avatar

How use MAIL_MAILER=sendmail by php mail() function in laravel

I need to use php mail() function to send mail to users. here env


MAIL_MAILER=sendmail
MAIL_SENDMAIL='/usr/sbin/sendmail -t -i'
MAIL_HOST=
MAIL_PORT=
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"

here config mail

 'default' => env('MAIL_MAILER', 'sendmail'),
 'sendmail' => [
            'transport' => 'sendmail',
            'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -t -i'),
        ],

but no mail send into user gmail inbox. what are missing here can you help me

0 likes
10 replies
Sinnbeck's avatar

Remember to check the spam folder. Using sendmail like that can easily result in the email ending up there

Also make sure you actually have sendmail in that path. Run it in a terminal

johndoee's avatar

@Sinnbeck I found sendmail path as C:\xampp\sendmail\sendmail.exe in phpmyinfo how can edit it in config

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

@kyawswar change your env

MAIL_SENDMAIL='C:\xampp\sendmail\sendmail.exe -t -i' 
1 like
Sinnbeck's avatar

@kyawswar I am confused. It seems in your other thread you are using the solution from here?

But why not just use smtp

johndoee's avatar

@Sinnbeck I re download sendmail and configure it to fit with sendmail path. I am still beginner in laravel , I not know much about smtp driver

Please or to participate in this conversation.