Adding users (03.02.2019)#

You can use any system account

adduser username
Note: to read those local emails in Linux check file /var/mail/<username>
or use command "mail", to be installed with "apt-get install mailutils".

Virtual Domain at /etc/postfix/virtual

1. You should have a virtual domain, exclude this at "mydestination", see Postfix guide

vi /etc/postfix/
    virtual_alias_domains =,, ...
    virtual_alias_maps = hash:/etc/postfix/virtual
2. create a addresses file (/etc/postfix/virtual)
vi /etc/postfix/virtual postmaster       joe      jane
    # Uncomment entry below to implement a catch-all address
    #         jim
    ...virtual aliases for more domains...
postmap /etc/postfix/virtual
postmap /etc/postfix/vmailbox
postfix reload
postfix stop
postfix start
service postfix restart
postsuper -d ALL  <= delete all mails in queue
vi /var/log/mail.log
grep postfix /var/log/syslog

Virtual alias Domain vs virtual mailbo domain#

Virtual alias domains are not to be confused with the virtual mailbox domains that are implemented with the Postfix virtual(8) mail delivery agent. With virtual mailbox domains, each recipient address can have its own mailbox. With a virtual alias domain, the virtual domain has its own user name space.
vi /etc/postfix/
    virtual_mailbox_domains =
    virtual_mailbox_base = /var/mail/vhosts   <= base folder fo all mailboxes
    virtual_mailbox_maps = hash:/etc/postfix/vmailbox <= subdirectories per mailbox
    virtual_minimum_uid = 100  <= for safety
    virtual_uid_maps = static:5000 <= system user for all emails
    virtual_gid_maps = static:5000 <= system group for all emails
    virtual_alias_maps = hash:/etc/postfix/virtual <= email addresses

vi /etc/postfix/vmailbox <= folders for mailboxes
    # Comment out the entry below to implement a catch-all.

/etc/postfix/virtual: postmaster

Pop3 / IMAP#

to betested:
  • Postfix is able to deliver POP3, then each mail address need to be mapped to a linux user for a proper password
  • for IMAP you should use dovecot

Forward email with Postfix (Mailserver)#

Postfix is a mail server and it is used to forward mails to to any external account.
(Hint: It does not matter, if is a redirection to any other server like

The postfix setup is described here,
but I had to modify it a little:
1. Installation

> su
> apt-get update
> apt-get install postfix
> postfix reload
2. Check
> postfix check
> nmap localhost -p 25
> telnet localhost 25
> postconf -d
> tail /var/log/mail.log
  • If nmap does not work, then install it first
> apt-get install nmap
3. Configure Postfix (edit /etc/postfix/
  • Add/replace at the top
  • Extend
mydestination =, ...
mynetworks = ...


# myorigin = /etc/mailname
  • Add/replace regarding SPAM rejection
# anti-spam: smtp restrictions
smtpd_recipient_restrictions = reject_invalid_hostname,
smtpd_helo_restrictions = reject_invalid_helo_hostname,
smtpd_client_restrictions = reject_rbl_client
  • Open Port 25 for the outside world
inet_interfaces = all
  • Save/Close and restart postfix (shell)
> service postfix restart

4. Setup email users

  • Edit /etc/aliases
# This means that will be forwarded to
Hint: You should setup at least following email addresses
  • webmaster@<your-domain>
  • postmaster@<your-domain>
  • abuse@<your-domain>
  • Enter in shell:
> postconf -e "alias_maps=hash:/etc/aliases"
> newaliases
> postfix reload [or service postfix restart]

Disable email settings from your domain provider#

If your domain provider also offers a mail server for your domain, you should disable that one and create a so called MX-Record, where you put your own server name as mail server. At Strato it must also have an ending dot at the name (?).

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-) was last changed on 04-Feb-2019 20:20 by Administrator