Send & Receive mails to & from localhost

Mails don't work when locally but sometimes it might prove to be very useful in development if one can send & receive mails to & from localhost. It can be setup pretty easily too. Basic idea is to configure postfix for localhost & then use mutt to read local mails. Here is how it is done (should work fine for any UNIX based OS):

Install postfix

sudo apt-get install postfix

Install mutt

sudo apt-get install mutt

To configure postfix for localhost, specify the following in its config file at /etc/postfix/

myorigin = localhost
mydestination = $myhostname, localhost.$mydomain, localhost
mynetworks = [::ffff:]/104 [::1]/128
relayhost =

Restart postfix

sudo /etc/init.d/postfix restart

Now you can read localhost mails using mutt


It will read emails from /var/mail/USERNAME

Published by


Developer + Entrepreneur + Open Source fanatic. Love WordPress + Startups + Adventure + Music.

  • chiru

    i have gone through your article.good article.
    Is it works on windows platform?

    • Ashfame

      Sorry! Only for unix based OS – linux / MAC

  • Daniel

    Nice tutorial. Will this work if using MAMP on mac?

    • Ashfame

      Should work just fine.