I think your problem is in :
'from' => ['address' => null, 'name' => null],
That's where you can set the sender address - either by hard-coding it in there or using the env() functions like for the 'host' parameter.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi guys,
First, I'm sorry for my english.
I'm training on Laravel, and I want to send mail in local. For this, I downloader MailCatchers, and tried to send a mail like this :
public function contact(){
Mail::send('auth.emails.contact', ['username' => 'test'], function($message){
$message->to('[email protected]')->subject('Welcome');
});
}
But here, I have an error "Cannot send a message without a sender adress". I don't know what to do for resolve this error.
If you want, my mail.php file :
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'from' => ['address' => null, 'name' => null],
'encryption' => false,
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
And the mail part of my .env file
MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
Well, thank you in advance if you have an idea that can help me to resolve my problem !
Please or to participate in this conversation.