Postfix to deliver mail to a virtual address mailbox

6,106

It seems as if you've only defined the virtual domains to accept mail for. You also need to define the accounts.

Do that with the directive virtual_mailbox_maps in main.cf

Read more about it here: http://www.postfix.org/postconf.5.html#virtual_mailbox_maps

Share:
6,106

Related videos on Youtube

Chloe
Author by

Chloe

Updated on September 18, 2022

Comments

  • Chloe
    Chloe over 1 year

    Postfix version 2.6.6, Dovecot Version 2.0.9

    I want to setup Postfix + Dovecot. Dovecot seems to be working. I can authenticate. However, the mailbox is empty! Nothing will get delivered! I followed many tutorials on Postfix + Dovecot but they seem to want to complicate things by using Dovecot LDA or MySQL. I just want it to be very simple and having Postfix deliver to the virtual mail boxes are fine. I don't need MySQL either. I already set up a custom password file that Dovecot uses for authentication and I can login to POP3 with SSL.

    I can see from the logs that Postfix is delivering to the system user accounts (the catch-all), instead of the virtual users that I set up in Dovecot. The SMTP + SSL authentication seems to work also.

    I can also see from the logs that Dovecot is checking the correct virtual mail folder.

    I just need to figure out how to get Postfix to deliver to the virtual mail boxes. I have the following which I believe are relevant. Let me know what other settings you need to see:

    alias_maps = hash:/etc/aliases
    mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
    mydomain = xxx.com
    myhostname = mail.xxx.com
    mynetworks = 99.99.99.99, 99.99.99.99
    myorigin = $mydomain
    relay_domains = $mydestination, xxx.com, domain2.net, domain3.com
    sendmail_path = /usr/sbin/sendmail.postfix
    setgid_group = postdrop
    smtpd_recipient_restrictions = reject_non_fqdn_sender reject_non_fqdn_recipient reject_unknown_recipient_domain permit_sasl_authenticated check_relay_domains
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_path = private/auth
    smtpd_sasl_type = dovecot
    smtpd_sender_restrictions = check_sender_mx_access cidr:/etc/postfix/bogus_mx reject_invalid_hostname reject_unknown_sender_domain reject_non_fqdn_sender
    virtual_mailbox_base = /var/spool/vmail
    virtual_mailbox_domains = xxx.com, domain2.net, domain3.com
    virtual_minimum_uid = 444
    

    Postfix master.cf:

    submission inet n       -       -       -       -       smtpd
      -o smtpd_tls_security_level=encrypt
      -o smtpd_sasl_auth_enable=yes
      -o smtpd_sasl_type=dovecot
      -o smtpd_sasl_path=private/auth
      -o smtpd_sasl_security_options=noanonymous
      -o smtpd_sasl_local_domain=$myhostname
      -o smtpd_client_restrictions=permit_sasl_authenticated,reject
      -o smtpd_sender_login_maps=hash:/etc/postfix/virtual
      -o smtpd_sender_restrictions=reject_sender_login_mismatch
      -o smtpd_recipient_restrictions=reject_non_fqdn_recipient,reject_unknown_recipient_domain,permit_sasl_authenticated,reject
    

    Dovecot related:

    mail_location = maildir:~/Maildir
    passdb {
      args = /etc/dovecot/users.conf
      driver = passwd-file
    }
    service auth {
      unix_listener /var/spool/postfix/private/auth {
        mode = 0660
        user = postfix
      }
    }
    

    The virtual mail user:

    vmail:x:444:99:virtual mail users:/var/spool/vmail:/sbin/nologin
    

    Here is the /var/log/maillog when I try to send something to myself:

    Oct 25 22:10:05 308321 postfix/smtpd[2200]: connect from user-999.cable.mindspring.com[99.99.99.99]
    Oct 25 22:10:05 308321 postfix/smtpd[2200]: D224BD4753: client=user-999.cable.mindspring.com[99.99.99.99], sasl_method=LOGIN, [email protected]
    Oct 25 22:10:06 308321 postfix/cleanup[2207]: D224BD4753: message-id=<7DC3C163CFFC483AB6226F8D3D9969D2@dumbopc>
    Oct 25 22:10:06 308321 postfix/qmgr[2168]: D224BD4753: from=<[email protected]>, size=1385, nrcpt=1 (queue active)
    Oct 25 22:10:06 308321 postfix/smtpd[2200]: disconnect from user-999.cable.mindspring.com[99.99.99.99]
    Oct 25 22:10:06 308321 postfix/local[2208]: D224BD4753: to=<[email protected]>, orig_to=<[email protected]>, relay=local, delay=1.1, delays=0.53/0.02/0/0.51, dsn=2.0.0, status=sent (delivered to mailbox)
    Oct 25 22:10:06 308321 postfix/qmgr[2168]: D224BD4753: removed
    
  • Chloe
    Chloe over 11 years
    Ok I added virtual_mailbox_maps = hash:/etc/postfix/vmailbox and the file /etc/postfix/vmailbox with info@domain\t\tdomain.com/info/, and ran postmap /etc/postfix/vmailbox and postfix reload but it still gives this in the logs: Oct 26 03:32:08 308321 postfix/local[5303]: 72629D4753: to=<[email protected]>, orig_to=<[email protected]>, relay=local, delay=0.68, delays=0.49/0.01/0/0.17, dsn=2.0.0, status=sent (delivered to mailbox). It's still going to the system user mailbox, and not the virtual Maildir: ls -lR /var/spool/vmail/...
  • Chloe
    Chloe over 11 years
    Had to add domain to virtual_mailbox_domains, and look at all the warnings in the logs about warning do not list domain in BOTH blah_blah and foo_bar. Had to clean it up and remove from here & there. Also had to change destination folder to domain.com/info/Maildir/ in vmailbox and re-run postmap because that is where Dovecot expects it.
  • Jesse the Wind Wanderer
    Jesse the Wind Wanderer almost 6 years
    Hi Chloe, I've got a similar problem. I've just renamed my server from vps.mydomain.com.au to strait mydomain.com.au and now my emails to [email protected] are being delivered to my local user jesse and not to the /var/spool/vmail/ any more. Can you remember how you made that happen? Cheers
  • Jesse the Wind Wanderer
    Jesse the Wind Wanderer almost 6 years
    Ah actually I found my answer just after I posted that comment; here I had mydomain.com.au listed in mydestination in /etc/postfix/mail.cf Removing it solved the problem.