Loading ...
Sorry, an error occurred while loading the content.

Forward mail and receive mail to the same domain

Expand Messages
  • Dotan Cohen
    I need to set up a virtual alias (forwarder) and a virtual mailbox on the same domain. I m using Postfix on Ubuntu Server 12.04. Here is my setup: $ cat
    Message 1 of 3 , Jul 5, 2013
    • 0 Attachment
      I need to set up a virtual alias (forwarder) and a virtual mailbox on
      the same domain. I'm using Postfix on Ubuntu Server 12.04. Here is my
      setup:

      $ cat /etc/postfix/main.cf
      smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
      biff = no

      append_dot_mydomain = no
      readme_directory = no

      # 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:${data_directory}/smtpd_scache
      smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

      myhostname = awsBeta
      alias_maps = hash:/etc/aliases
      alias_database = hash:/etc/aliases
      mydestination = awsBeta, localhost.localdomain, , localhost
      relayhost =
      mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
      mailbox_size_limit = 0
      recipient_delimiter = +
      inet_interfaces = all

      virtual_mailbox_domains = someDomain.com
      virtual_mailbox_base = /var/mail/vhosts
      virtual_mailbox_maps = hash:/etc/postfix/vmailbox
      virtual_minimum_uid = 100
      virtual_uid_maps = static:5000
      virtual_gid_maps = static:5000

      virtual_alias_domains = someDomain.com

      $ cat /etc/postfix/virtual
      forward@... test@...

      $ cat /etc/postfix/vmailbox
      dotan@... someDomain.com/dotan

      $ sudo postmap virtual
      $ sudo postmap vmailbox
      $ tree /var/mail/vhosts/
      /var/mail/vhosts/
      └── someDomain.com
      └── dotan

      When mail is sent to forward@... it is properly forwarded
      to test@.... However, when mail is sent to dotan@...
      the sending address receives a mail with this error:
      Recipient address rejected: User unknown in virtual alias table

      This appears in the log:
      warning: do not list domain someDomain.com in BOTH
      virtual_alias_domains and virtual_mailbox_domains

      Of course, I cannot remove the domain from either
      virtual_alias_domains or virtual_mailbox_domains because I need to use
      bothe of those features. So how might one set up dotan@...
      as a real mailbox (no unix account though), but forward@...
      to forward to test@...? I've been trolling Google for answers,
      but though I thought that this would be easy, I'm stuck!


      --
      Dotan Cohen

      http://gibberish.co.il
      http://what-is-what.com
    • Viktor Dukhovni
      ... Go ahead and remove the domain from virtual_alias_domains, virtual alias expansion applies to *all* domains regardless of address class. -- Viktor.
      Message 2 of 3 , Jul 5, 2013
      • 0 Attachment
        On Fri, Jul 05, 2013 at 04:19:36PM +0300, Dotan Cohen wrote:

        > This appears in the log:
        > warning: do not list domain someDomain.com in BOTH
        > virtual_alias_domains and virtual_mailbox_domains
        >
        > Of course, I cannot remove the domain from either
        > virtual_alias_domains or virtual_mailbox_domains because I need to use
        > both of those features.

        Go ahead and remove the domain from virtual_alias_domains, virtual
        alias expansion applies to *all* domains regardless of address
        class.

        --
        Viktor.
      • Dotan Cohen
        On Fri, Jul 5, 2013 at 4:22 PM, Viktor Dukhovni ... Thank you, that works! Tell me please, what should the permissions be for /var/mail/vhosts/someDomain?
        Message 3 of 3 , Jul 6, 2013
        • 0 Attachment
          On Fri, Jul 5, 2013 at 4:22 PM, Viktor Dukhovni
          <postfix-users@...> wrote:
          > Go ahead and remove the domain from virtual_alias_domains, virtual
          > alias expansion applies to *all* domains regardless of address
          > class.
          >

          Thank you, that works!

          Tell me please, what should the permissions be for
          /var/mail/vhosts/someDomain? Which user and group should it belong to?
          Postfix was unable to create the directory and I am having a hard time
          beteen the users 'mail', 'postfix', '5000', and 'root' and the proper
          permissions.

          --
          Dotan Cohen

          http://gibberish.co.il
          http://what-is-what.com
        Your message has been successfully submitted and would be delivered to recipients shortly.