How To / Tutorials 1 min read

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/main.cf

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

Restart postfix

sudo /etc/init.d/postfix restart

Now you can read localhost mails using mutt

mutt

It will read emails from /var/mail/USERNAME

4 comments

  1. chiru

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

    1. Ashfame AUTHOR
      replying to chiru

      Sorry! Only for unix based OS – linux / MAC

  2. Daniel

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

    1. Ashfame AUTHOR
      replying to Daniel

      Should work just fine.

Leave a comment

Your email stays private. Required fields are marked