2

My environment:

# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.6 (Santiago)
# rpm -q postfix
postfix-2.6.6-6.el6_5.i686
# 

I switched home_mailbox from Mailbox to Maildir/:

# postconf -n | grep home_mailbox
home_mailbox = Maildir/
# 

I'm sending myself a test email: [email protected], yet email gets delivered to [email protected] instead, for whatever reason(s) it ignores my +A alias.

My goal is for [email protected] to get delivered to ~test/Maildir/.A/ and not into ~test/Maildir/.

What am I doing wrong? What am I missing?

2
  • 1
    You can do that with sieve and the FS-Layout of Maildir. Use dovecot as LDA and activate sieve, then write a sieve script that moves the mails according to the local part of the address.
    – sebix
    Jun 23, 2015 at 19:02
  • Any updates on this question? Did my solution below work in your case? :)
    – masegaloeh
    Sep 6, 2015 at 9:38

1 Answer 1

2

Here the extended version of @sebix's comment above. This untested solution taken directly from dovecot 2 wiki: Pigeonhole Sieve examples.


You need subaddress extension from dovecot sieve to do it. Put it in sieve script. Here the simple example to put email [email protected] to Spam folder.

require ["fileinto", "envelope", "subaddress"];
if envelope :detail "to" "spam"{
  fileinto "Spam";
}

The more advanced example is use regex to capture the address extension and put it in same folder. For example [email protected] will delivered on A subfolder, [email protected] will delivered on B subfolder and so on

require ["variables", "envelope", "fileinto", "subaddress"];
if envelope :is :user "to" "test" {
  if envelope :matches :detail "to" "*" {
    /* Save name in ${name} in all lowercase except for the first letter.
     * Joe, joe, jOe thus all become 'Joe'.
     * Of course you can set into all lowercase letter
     */
    set :lower :upperfirst "name" "${1}";
  }

  if string :is "${name}" "" {
    /* Default case to INBOX */
    fileinto "INBOX";
  } else {
    fileinto "${name}";
  }
}

To work with Postfix, this requires that the envelope "to" still contains the full address, so pass it with the -a flag.

For local delivery set

mailbox_command = /usr/lib/dovecot/dovecot-lda -a "$RECIPIENT"

or for virtual delivery

dovecot unix    -       n       n       -       -      pipe
  flags=DRhu user=mail:mail argv=/usr/local/libexec/dovecot/dovecot-lda
  -f ${sender} -d ${user}@${nexthop} -a ${recipient}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .