If your application sends emails, you probably don’t want emails to be sent when you are developing on your machine.
If you use nice libraries like SwiftMailer, it is easy to use a mock instead of sending real emails. But if you don’t, you can act on PHP’s configuration: instead of installing and using a real SMTP server on your machine, you can fake one using a simple script.
The fake server will be a shell script: create it as
1 2 3 4 5 6
Set up file permissions and check that it works:
1 2 3
Now configure PHP to use it in the
(and restart Apache)
You can also see the emails content in
You could even go further and edit the script to open the content of the mail into a text editor, or a browser. But that would be OS dependent, so I kept with the log file here.