CentOS 7.x postfix email virtualhosting

From Notes_Wiki
Revision as of 05:06, 12 June 2017 by Saurabh (talk | contribs) (Created page with "<yambe:breadcrumb>CentOS_7.x_postfix_configuration|CentOS 7.x postfix configuration</yambe:breadcrumb> =CentOS 7.x postfix email virtualhosting= It is possible to setup postf...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<yambe:breadcrumb>CentOS_7.x_postfix_configuration|CentOS 7.x postfix configuration</yambe:breadcrumb>

CentOS 7.x postfix email virtualhosting

It is possible to setup postfix server for multiple domains (eg sbarjatiya.com, pbarjatiya.com, etc.) on a single server. To perform postfix email virtualhosting use following steps:

  1. Edit /etc/postfix/main.cf as follows
    1. Set myhostname = localhost
    2. Add following lines at bottom
      virtual_mailbox_domains = /etc/postfix/vhosts.txt
      virtual_alias_maps = hash:/etc/postfix/valias.txt
  2. Create /etc/postfix/vhosts.txt and write one domain name on each line. For example
    sbarjatiya.com
    pbarjatiya.com
  3. Create /etc/postfix/valias.txt. Write incoming and forwarding address one on each line. For domain forwarding mention incoming address as @domain.
    saurabh@sbarjatiya.com barjatiya.saurabh@gmail.com
    spam@sbarjatiya.com saurabhisgood@yahoo.com
    @sbarjatiya.com check-when-free@gmail.com
    parag@pbarjatiya.com parag@gmail.com
    priyanka@pbarjatiya.com priyanka@gmail.com
    @pbarjatiya.com check-when-free@gmail.com
  4. Create map using
    cd /etc/postfix
    postmap valias.txt
  5. Reload postfix using
    systemctl reload postfix
  6. Test by sending various emails to different domains. You can check queue on server using "postqueue -p" in case email is not delivered. Also check /var/log/maillog for troubleshooting.


Refer;