Simple Mail Set up with Postfix

From Initq

Jump to: navigation, search

This simple setup will

  1. Great mail clients with correct hostname
  2. Accept mail for the domain
  3. Append domain name after the username
  4. Deliver mail addressed to root to a different username
  5. Replay email from internal authorized ip address
  6. Deliver mail to correct usernames
  7. Work on all interfaces of the mail srevre

Contents

Setting up the Hostname in the smtpd Banner

If your host name is lexiana.com then you want to greet mail clients with mail.lexiana.com.

When talking to other mail server postfix uses the myhostname parameter as the HELO name.

myhostname = mail.lexiana.com

You can also set mydomain parameter instead of myhostname if you want to copy the main.cf file to other systems. This was the mydoain will pick up the rest from the hostname of the server and fill the complete FQDN.

mydomain = lexiana.com

Setting the Domain Mail is accepted for

Postfix will accept mail for any domain that is mentioned in the mydestination parameter.

mydestination = $mydomain
 
or
 
mydestination = $mydomain, $myhostname
 
or
 
mydestination = 
$mydomain,
$myhostname,
wwww.$mydomain,
ftp.$mydomain

Setting the Domain to be Appended to Outgoing Messages

When local accounts send email they do not append the proper origin so this parameter defines this.

myorigin = $mydomain

Mapping Mail Sent to root to Different Mailbox

This needs to be done is a file called /etc/postfix/aliases.

root: admin

After creating the file you will have to create an indexed version. to do this run:

  • postalias /etc/postfix/alises

Then in the main.cf, you have to enter:

alias_maps = hash:/etc/postfix/db/aliases,
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
 
 
# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
myorigin = /etc/mailname
 
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
 
# appending .domain is the MUA's job.
append_dot_mydomain = no
 
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
 
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache
 
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
 
myhostname = dominion.apptricityondemand.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
#mydestination = apptricity.com, localhost.com, localhost
relayhost =
mynetworks = 127.0.0.0/8, 192.168.168.0/24, 192.168.170.0/24
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
#inet_interfaces = loopback-only
inet_interfaces = all
inet_protocols = all
Personal tools