When you first install Postfix on Linux systems using apt-get install postfix
or similar package managers, the installation process typically presents an interactive configuration wizard. This wizard asks critical questions about your mail server configuration:
General type of mail configuration:
1. Internet Site
2. Internet with smarthost
3. Satellite system
4. Local only
To revisit this configuration screen after initial installation, you need to trigger the post-install configuration script:
sudo dpkg-reconfigure postfix
This command will relaunch the interactive configuration dialog where you can modify your previous choices.
For more advanced users who prefer direct file editing, the main Postfix configuration file is located at:
/etc/postfix/main.cf
Key parameters you might want to modify include:
myhostname = mail.example.com
mydomain = example.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
relayhost =
mynetworks = 127.0.0.0/8
After making changes (either through dpkg-reconfigure or manual editing), always:
sudo postfix check
sudo systemctl restart postfix
To test if your configuration works properly:
echo "Test email body" | mail -s "Test Subject" user@example.com
Changing from Local Only to Internet Site:
# Edit /etc/postfix/main.cf
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
Adding Smarthost Relay:
relayhost = [smtp.provider.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_security_level = encrypt
Check mail logs for errors:
tail -f /var/log/mail.log
Verify Postfix is running with correct configuration:
postconf -n
When installing Postfix on Linux systems (Debian/Ubuntu), the package configuration presents several mail server scenarios:
# Common installation options presented during setup:
1. Internet Site (Direct SMTP delivery)
2. Internet with smarthost (Relay through another server)
3. Satellite system (All mail forwarded to another server)
4. Local only (No network delivery)
To restart the initial configuration dialog, use the dpkg-reconfigure command:
sudo dpkg-reconfigure postfix
For more granular control, edit these key files:
# Main configuration file
sudo nano /etc/postfix/main.cf
# Master process configuration
sudo nano /etc/postfix/master.cf
After making changes, always test your configuration:
# Check configuration syntax
sudo postfix check
# Reload Postfix
sudo systemctl reload postfix
# View mail queue
mailq
Example 1: Changing from 'Local only' to 'Internet Site':
# In /etc/postfix/main.cf
myhostname = mail.example.com
mydomain = example.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128