PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, April 18, 2022

[FIXED] How to configure Laravel mail.php to use built-in mail function?

 April 18, 2022     email, laravel, php     No comments   

Issue

I need to send an email via the mail() PHP function. I've read somewhere that I have to change 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 this:

'driver' => 'mail',

But still, the mail() function doesn't work. What do I need to change?


Solution

You can set your mail configuration .env file like

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

also set configuration in config/mail.php like:

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

then you can clear the cache:

php artisan config:cache
php artisan cache:clear


Answered By - AddWeb Solution Pvt Ltd
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing