Test sending emails with PapercutSMTP in PHP using XAMPP
Sending email with PHP is very easy. We can create a local SMTP server to test it. There are many apps available for that. But In this article we are going to use PapercutSMTP.
PapercutSMTP
Papercut creates a local SMTP server for testing purpose. This is probably the best app for this on Windows platform. Let’s see how to download and configure PapercutSMTP.
Download PapercutSMTP
You download latest PapercutSMTP app from GitHub releases page. Look for Papercut.Setup.exe
, download and install it from the following link. https://github.com/ChangemakerStudios/Papercut-SMTP/releases
Sending email
We can send email with mail()
in PHP. Now create a PHP file like the following
|
If you open the page in the browser you should see a success message.
A notifcation will also appear in the notification area.
You can open the PapercutSMTP app to see all the local emails sent.
You can also access the web based UI from http://127.0.0.1:37408/
If you see the email in the box, you are done ! You can skip rest of this post.
Troubleshooting
If you face any problems in the step above you can the configuration. If something is changed update it according to this post otherwise ignore it.
Update PHP configuration
Open php.ini
and search for mail function. Set SMTP=localhost
and smtp_port=25
in php.ini
file.
[mail function] |
Update sendmail configuration
Open sendmail.ini
from C:\xampp\sendmail\
directory and put smtp_server=localhost
and smtp_port=25
.
[sendmail] |