Receive emails with Laravel Mail Catcher
- Summarize the method to receive with MailCatcher sent from Laravel.
- Hardware environment
|Hardware||MacBook Pro (13-inch, 2020, Four Thunderbolt 3 ports)|
|Processor||2 GHz Quad Core Intel Core i5|
|Memory||32 GB 3733 MHz LPDDR4|
|Graphics||Intel Iris Plus Graphics 1536 MB|
- Software environment
|PHP version||7.4.3||Introduced using Homwbrew|
|Laravel version||7.0.8||Introduced by this method using commposer → Construct environment of Mac Laravel|
|MySQL version||8.0.19 for osx10.13 on x86_64||Introduced by this method using Homwbrew → Install MySQL with Mac Homebrew|
- The Laravel environment is constructed by the following method or a similar method. -Construct environment of Mac Laravel
- I built the Laravel environment directly on the Mac and implemented it.
- The environment of Laravel was implemented by the following method. Create and execute Laravel application in the following environment. -Construct environment of Mac Laravel
- The email sending process from the Laravel application is implemented by the following method. -Add processing to confirm email address when Laravel 7 user authentication
- MailCatcher can receive emails sent from Laravel.
- Installing and starting MailCatcher
- Description of .env file
Installing and starting MailCatcher
Execute the following command to install MailCatcher.
$ sudo gem install mailcatcher
Execute the following command to start MailCatcher.
Access the following. -http://127.0.0.1:1080
Confirm that the following page is displayed.
Description of .env file
Modify the Mail setting part of the .env file as follows.
MAIL_DRIVER=smtp MAIL_HOST=127.0.0.1 MAIL_PORT=1025 MAIL_ENCRYPTION=null [email protected] MAIL_FROM_NAME=admin MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_PRETEND=false
Send an email from the Laravel app.
When MailCatcher is displayed on the browser as shown below and it is confirmed that the mail can be received, the work is completed.