Free Open Source SMTP Testing tool with API, STARTTLS: Mailpit

0 Comments
Editor Ratings:
User Ratings:
[Total: 0 Average: 0]




Mailpit is a free and open-source software for email testing for your applications. It is quite an advanced tool than the one we have already covered and you can use it for very advanced testing of email delivery in your mobile or desktop apps. You can easily run it locally in just a few seconds and test any kind of email. It is made up of an SMTP server that listens to the background and a UI where you can see all the emails the server will receive.

Both the SMTP server as well as the web UI support basic user/password authentication. It even has support for STARTTLS and you can easily configure it if you have the proper certificate and private key files. You can also configure the SSL for the web UI where it shows all the emails it caught. There is no limit to the number of emails it can receive. You can have attachments in the testing email and you can also use it as a defacto SMTP server as well if you want to.

Take a look on the main features of Mailpit:

  • Lightning-fast SMTP server.
  • Binaries are available for all platforms so building or installing from the source code.
  • Secure and insecure SMTP support.
  • Supports SMTP relay mode to transfer mails to another SMTP server.
  • SSL support for web UI.
  • STARTTLS support for SMTP server.
  • sendmail like MTA support.
  • It has a fast search feature to find and sort emails.
  • Docker image support is available.
  • Supports health check endpoints to test if the server is running without any problems.
  • Mailpit provides a simple REST API to view, search and delete stored messages.

Setting up and using Mailpit:

You can run Mailpit in two ways. The first one is insecure mode and that is very easy to use. You just download the binary of Mailpit for your platform and then simply run it like this.

mailpit.exe --smtp-auth-allow-insecure

Mailpit Run Non Secure

The above mode is an insecure one without the user and password. Just start sending the emails to the local server at 1025.

If you want to add a basic authentication to the SMTP server then you need to create a credentials file. Add username and password combination like shown below and then save it. You can add as many usernames and password pairs as you want.

Create authentication file for Mailpit

Now, run the Mailpit server like this with the authentication file name.

mailpit.exe --smtp-auth-file Auth_File_Name --smtp-auth-allow-insecure

SMTP Mailpit Run Server with Auth

The server is up and running now. Go to localhost:80256 see the web UI. Initially it is blank but when you send some emails, they will show up here.

Mailpit Web UI

So, now, get SMTP client software and then prepare the test email. Configure the SMTP client to send the emails at the local host server (127.0.0.1) and on port 1025. Send as many emails as you want with or without the attachments.

SMTP Client to Test Mailpit

Go to UI and there you will see all the emails that it has received so far. Open an email and see the email body and other things such as attachments. If you have a lot of emails here then you can search for them using the search box on the mail UI.

Mailpit in Action

You can now keep using the SMTP server as above and test emails. You can try sending emails from your apps and if everything goes fine then you will receive them in the web UI. For more sophisticated usage with STARTTLS and SSL, you can see the Mailpit wiki.

Closing thoughts:

If you are a developer and often struggle to find a test SMTP server to test the email functionality of your apps or web apps then Mailpit is for you. Just give it a try and I am sure it will not let you down. It is very fast, powerful, and comes with almost all the features that a fully functional SMTP server has. All you have to do is just run it with fake credentials and start email testing.

Editor Ratings:
User Ratings:
[Total: 0 Average: 0]
Free/Paid: Free

Leave A Reply

 

Get 100 GB FREE

Provide details to get this offer