Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ygun/8c69c40811b3d512e1a1c0acd022cf35 to your computer and use it in GitHub Desktop.
Save ygun/8c69c40811b3d512e1a1c0acd022cf35 to your computer and use it in GitHub Desktop.
Setup a Local Only Email Server (Linux, Unix, Mac)

Setup a Local Only Email Server (Linux, Unix, Mac)

1 - Install Postfix

Ubuntu: sudo apt-get install postfix

2 - Configure Postfix to Local only

  • During postfix install process, the configure text dialog will display five options: "No Configurartion", "Internet Site", "Internet with Smarthost", "Satellite Systems", "Local Only".
  • Select "Local Only".
  • For the domain name, use the default suggested and finish the install.

3 - Configure a Catch-all Address

Enabling this, you can use any email address ending with "@localhost".

Example: here, my unique account is rael@localhost. But while testing systems, I can use any address like joe@localhost, foo@localhost, etc, because all will be redirected to rael@localhost

  • If not exists, create file /etc/postfix/virtual: sudo nano /etc/postfix/virtual
  • Add the following content, replacing with your user account: @localhost <your-user>
  • Save and close the file.
  • Configure postifx to read this file:
    • Open /etc/postfix/main.cf: sudo nano /etc/postfix/main.cf
    • And check if this line is enabled, or add it if not exists: virtual_alias_maps = hash:/etc/postfix/virtual
  • Activate it: sudo postmap /etc/postfix/virtual
  • Reload postfix: sudo service postfix reload

4 - Install Thunderbird

Ubuntu: sudo apt-get install thunderbird

5 - Configure Thunderbird

  • Skip the first welcome screen (click in the button to use existing accounts);
  • Click in the Settings button at top right (similar to Chrome settings) then click on Preferences > Account Settings
  • Under Account Actions choose "Add Other Account"
  • Select "Unix Mailspool (Movemail)"
  • Your account will be <your-user>@localhost (of course, replace <your-user> with your user account). Don't use <your-user>@(none), use <your-user>@localhost
  • Ingoing and Outgoing server will be: localhost
  • Restart (close and reopen) Thunderbird.

6 - Test Thunderbird

  • Send new email to <your-user>@localhost, replacing <your-user> with your user account
  • Click on "Get Mail"
  • Test catch-all: send new email to averagejoe@localhost
  • Click on "Get Mail"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment