How to Setup a Complete Mail Server (Postfix) using ‘SquirrelMail’ (Webmail) on Ubuntu/Debian

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.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

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...

189 Responses

  1. Advan Dan says:

    When I tried to create a MX record on my server on DigitalOcean, there is a session that says [MAIL PROVIDERS MAIL SERVER] and the example in that field reads aspmx.|

  2. Kenionek says:

    When I am trying to login it says: “You must be logged in to access this page.” How can I fix it?

  3. Chael Gutierrez says:


    I tried to send an email using the newly setup email server but, I don’t receive any email in my gmail. Does MX and SPF record, took times or days to be able my newly setup server to send email ?

    • doug says:

      Hi Chael. Both the MX and SPF records will take about two hours (depending on your location) to propagate to other DNS servers. I’ve heard of some cases of it taking a day, but not more than that.

      • Chael Gutierrez says:

        @doug can you help me setup a simple email server ?

        I already follow the tutorial and I receive email but sending email to my gmail doesn’t work.

        I don’t know if I miss something from my dns config, [email protected] is my email. if you can help me

  4. Deen says:

    Hi, How do I link it up with SQL so that users will have the freedom to reset their passwords to their choice? and enable password reset option in the web interface?

  5. doug says:

    Good tutorial, but I still get a time-out “ERROR: Connection dropped by IMAP server.”. Any ideas would be appreciated.

  6. Rahu says:

    I am not able to receive mail in Inbox. Is there anything missed like DNS configurations or something?

    • Ravi Saive says:


      Does the mail received in Spam section? Have you added correct MX and SPF records for your mail domain?

      • Rahu M says:

        Can your please explain that MX record and SPF record for my domain? Am using digitalocean and followed all above steps.

        • Ravi Saive says:


          Please check out the following article, and see the section – Create A and MX Records for Domain in DNS.

        • Aaron Kili says:


          MX (mail exchange) record is an entry in your DNS zone file that specifies a mail server to handle a domain’s email, and SPF(Sender Policy Framework) record is an entry in DNS zone file used to indicate to mail exchanges which hosts are authorized to send mail for a domain.

        • doug says:


          You will need (must have) a MX record in your DNS configuration. An example would be:

          MX   10

          A SPF (Sender Policy Framework) helps other email servers (like Gmail) to let them know that you are a legitimate email server and not pumping out spam. A SPF record would look something like this:

          v=spf1 mx -all 

          This is the one that I use and it has passed all spam filters and gmail.

  7. Nektarios says:

    Hi! I would like to ask what I should do if I have already installed an SSL certificate. Should I install a new certificate during the Dovecot installation or I could expand my certificate.

  8. Juan Sanchez says:

    How can I connect my email with Outlook?

  9. junaid says:

    Excellent excellent excellent and thanks

  10. Zac Garby says:

    On SquirrelMail, I get an error:

    ERROR: Could not complete request.
    Query: SELECT “INBOX”
    Reason Given: [SERVERBUG] Internal error occurred. Refer to server log for more information. [2018-04-06 18:33:43] (0.000 + 0.000 secs).

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.