Popularity: 1243210th place
No tags for this snippet yet.

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

Setup a Local Only Email Server (Linux, Unix, Mac): 
Email Server (Linux, Unix, Mac).md
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
# Setup a Local Only Email Server (Linux, Unix, Mac) ## 1 - Point to your machine Most of programs will not accept an email using just @localhost as domain. So, edit `/etc/hosts` file to make the domain point to your machine, including this content to the file: `` ## 2 - Install Postfix Fedora/CentOS/RHEL: `sudo yum install postfix` Ubuntu: `sudo apt-get install postfix` MacOSX: Postfix is already installed by default. ## 3 - Configure Postfix to Local only * During postfix install process, the configure text dialog will display five options: ```term General type of mail configuration: No configuration Internet Site Internet with smarthost Satellite system Local only ``` * Select "Local Only". * For the domain name, use the default suggested and finish the install. ## 4 - Configure a Catch-all Address Enabling this, you can use any email address ending with "@localhost" or "". Example: here, my unique account is But while testing systems, I can use any address like,, etc, because all will be redirected to * If not exists, create file /etc/postfix/virtual: `sudo nano /etc/postfix/virtual` * Add the following 2 lines content, replacing <your-user> with your user account: ``` @localhost <your-user> <your-user> ``` * Save and close the file. * Configure postifx to read this file: * Open /etc/postfix/ `sudo nano /etc/postfix/` * 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` * If you're under a `systemd` distro, like Fedora or Ubuntu 16.04, service restart command is: `sudo systemctl restart postfix` ## 5 - Install Thunderbird Ubuntu: `sudo apt-get install thunderbird` ## 6 - Configure Thunderbird * Skip the 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. ## 7 - Start your Mail Spool file * This step have two purposes: test your install and stop the `Unable to locate mail spool file.` message. * Using 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" and you'll see the message at `Inbox`.
If you want to be updated about similar snippets, Sign in and follow our Channels