Install a Complete Mail Server with Postfix and Webmail in Debian 9

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Matei Cezar

I'am a computer addicted guy, a fan of open source and linux based system software, have about 4 years experience with Linux distributions desktop, servers and bash scripting.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

44 Responses

  1. Ash says:


    I’m failing at step 20 can someone please help:

    [email protected]:~# nc localhost 25
    220 ESMTP Postfix (Debian/GNU)
    421 4.4.2 Error: timeout exceeded
    [email protected]:~#
  2. Samuel Weber says:

    Hello Sir,

    Thanks in advance for your help and your great article. I followed your guide and now I am at step20:

    # nc localhost 25
    results in
    220 ESMTP

    and then my command-line hangs. i waited several minutes to make sure. only way to process is ctrl+c.

    any hint whats wrong?

    netstat -tlpn from step19 showed me correct values.

    greetings, Sam

    • Ravi Saive says:


      Nothing wrong, your setup is working perfectly….

      • Samuel Weber says:

        @Ravi Saive

        Thank you for your fast response! So when you said my setup is working I finished the other steps in your guide.
        Now i can send E-Mails via mail() (PHP) or via Web mail-Interface.

        But i cannot receive Mails from Outside. I get following Error-MSG as response from my test-gmail-Account:

        > Delivery Status Notification (Failure)
        > Error occurred at sending your message to [email protected]
        > Response from Remote-Server
        > 550 Unroutable address

        Any hint? You really would save my day <3

        Thanks in advance, with best regards

        • Ravi Saive says:


          You are sending the email to a non-existing recipient domain, it shows a ‘550-Unrouteable address’ error.

          • Samuel Weber says:


            I feel like a moron ;) Everything works like a charm. You are a hero! Thank you sir

  3. Pierre says:

    Hello, when I try to log in to RainLoop with my login, a message will appear indicating “Authentication failed”, I said that all the previous steps work perfectly.

    The log window shows me this:

    "imap-login: Disconnected (auth failed, 1 attempts in 4 secs): user = , method = PLAIN, rip =, lip =, secured, session = "

    I can not find where the problem comes from, does anyone have an idea? Thank you in advance :)


  4. Moreno Andreo says:

    Does it work with multiple mail domains? (say [email protected], [email protected], and so on).


  5. fatemeh karimi says:

    Thanks for your perfect article. it workes without any problem :))

  6. Thomas says:

    Hi, When I execute the following code:

    nc localhost 143
    x1 LOGIN user pass

    The return is: x1 OK ……. Logged in. But I can’t login with those credentials in the web interface

    Any ideas?

  7. James R says:

    Hi, would this work with an apache server running at the same time?

  8. Simone says:


    I’m getting a ‘Temporary lookup failure’ when trying to send an email to a valid mail address. From logs:

    (451, '4.3.0 : Temporary lookup failure')}

    Any suggestion?


    • Simone Ceccolini says:

      Please consider the mail sending is failing from any host outside the mail server. In parameter I put the corresponding host ip but the mail sending is failing.


  9. igaz says:


    In postfix (install mailserver rainlop)


    should i change it to

    • Ravi Saive says:


      The ssl-cert-snakeoil.pem and ssl-snakeoil.key is created by ssl-cert for snakeoil user and should not be deleted:..

  10. Imed says:

    Hi, I’m following this article to install mail server at work. I’m stuck at this step:

    nc localhost 143
    x1 LOGIN user pass
    the terminal replies: 
    x1 NO [AUTHENTICATIONFAILED] Authentication failed.

    But I am sure from user and pass, I created it from the guide, you used “Matie“, I user “imed”, username and password are the same.

    Any Idea?

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.