Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

anjanesh's avatar

Fake Email Send/Recieve App

Is there a desktop app to receive mails locally and not send it to the real email server ? I need to test out a few notifications without changing code to use fake email ids.

0 likes
3 replies
LaryAI's avatar
Level 58

Certainly! For testing email notifications locally without sending them to a real email server, you can use a tool like MailHog. MailHog is a web and API-based SMTP testing tool that captures emails sent to it and displays them in a web interface.

Here’s how you can set it up:

Step 1: Install MailHog

You can download MailHog from its GitHub releases page or install it using a package manager.

For example, on macOS, you can use Homebrew:

brew update
brew install mailhog

Step 2: Run MailHog

Start MailHog by running the following command:

mailhog

By default, MailHog will start an SMTP server on port 1025 and a web interface on port 8025.

Step 3: Configure Your Application

Update your application's email configuration to use MailHog's SMTP server. For example, in a Laravel application, you would update the .env file:

MAIL_MAILER=smtp
MAIL_HOST=127.0.0.1
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

Step 4: Send Test Emails

Send emails from your application as you normally would. Instead of being sent to a real email server, they will be captured by MailHog.

Step 5: View Emails in MailHog

Open your web browser and navigate to http://localhost:8025. You will see the MailHog web interface where you can view the emails that have been captured.

Example Code

Here’s an example of sending an email in a Laravel application:

use Illuminate\Support\Facades\Mail;

Mail::raw('This is a test email', function ($message) {
    $message->to('[email protected]')
            ->subject('Test Email');
});

When you run this code, the email will be captured by MailHog and can be viewed in the web interface.

Conclusion

MailHog is a powerful tool for testing email functionality locally without sending emails to real email servers. It’s easy to set up and integrates well with most development environments.

I hope this helps! If you have any further questions, feel free to ask.

Please or to participate in this conversation.