Testing Mailpit

These instructions provide an easy way to “send” a test email to Mailpit to ensure it is working. This assumes Mailpit is running, and is listening on port 1025 (default).

Create a text file email.txt with the following contents.

From: [email protected]
To: [email protected]
Subject: Email Subject

This is the body of the email.
It can contain multiple lines of text.

Then run the following command to “send” your test email:

mailpit sendmail < email.txt

If you are using a system-installed version of sendmail, your command may look like this:

sendmail -t -S localhost:1025 < email.txt
Please note that various packages provide different implementations of sendmail, and they all work slightly different to each other, so please refer to the help of your version of sendmail.

Test using telnet

You can also send an email directly to Mailpit using telnet:

{
  echo "EHLO localhost"
  echo "MAIL FROM: <[email protected]>"
  echo "RCPT TO: <[email protected]>"
  echo "DATA"
  echo "From: <[email protected]>"
  echo "To: <[email protected]>"
  echo "Subject: Your Subject"
  echo ""
  echo "Your message body"
  echo "."
  echo "QUIT"
} | telnet localhost 1025

Edit this page

On this page