Hosting Question? Find the Solution - Browse our Guides, Articles, and How-To's

How to Configure Subaddressing/PlusAddressing in DirectAdmin?

What is Subaddressing?

Subaddressing is also known as ‘plus addressing’ or ‘detailed addressing’, and describes the ability to send email to an address that not only contains an email username, an @ character, and a domain, but also a delimiter character and a ‘detail’ string. For example, sending an email to the address, which uses the + as the delimiter and mailinglist as the detail, constitutes subaddressing.

The different parts of the email address are defined like so according to RFC 5233,

          :user "+" :detail  "@" :domain

So, the local-part is composed of both the user and the detail components with regards to subaddressing.

The RFC, which outlines Sieve Email Filtering, describes subaddressing like so,

   Subaddressing is the practice of augmenting the local-part of an
   [RFC2822] address with some 'detail' information in order to give
   some extra meaning to that address.  One common way of encoding
   'detail' information into the local-part is to add a 'separator
   character sequence', such as "+", to form a boundary between the
   'user' (original local-part) and 'detail' sub-parts of the address,
   much like the "@" character forms the boundary between the local-part
   and domain.

   Typical uses of subaddressing might be:

   o  A message addressed to "" is delivered into a
      mailbox called "sieve" belonging to the user "ken".

   o  A message addressed to "" is delivered to
      the voice mailbox number "123" at phone number "5551212".

Why would one want to use this? Some use cases include:

  • Better organization of one’s inbox by organizing mailing list subscriptions into their own folders
  • Identifying subscriptions that may have sold your contact information/email address
  • To detect and discard or redirect spam messages

To configure subaddressing on a DirectAdmin box, one must edit the configurations of Exim and Dovecot, and then add the appropriate Sieve filter rules. Sieve filtering is accomplished via Pigeonhole for Dovecot, which adds support for the Sieve language (RFC 5228) and the ManageSieve protocol (RFC 5804) to Dovecot.

Configure Exim To Support Subaddressing

Exim already includes a condition for plus addressing,

  .include_if_exists /etc/exim/local_part_suffix.conf

So all we need to do is create the parent directory and the file with the necessary contents.

Create the directory like so,

  mkdir /etc/exim

Then create the file,

  touch /etc/exim/local_part_suffix.conf

Add the following contents to the file,

  local_part_suffix = +*

Or, if you want to allow a plus, a hyphen, and an underscore to all function as delimiters that separate the local_part into user and detail parts,

  local_part_suffix = +* : -* : _*

Now restart Exim and plus addressing should now work in Exim,

  service restart exim

Configure Dovecot for Subaddressing

First, enable Pigeonhole,

  cd /usr/local/directadmin/custombuild
  ./build set pigeonhole yes
  ./build pigeonhole
  ./build roundcube

Upon enabling Pigeonhole, you will see a “Filters” section in RoundCube settings.

Next, create the following file,


Add the following contents into the subaddressing.conf file,

  recipient_delimiter = +
  lmtp_save_to_detail_mailbox = yes
  lda_mailbox_autocreate = yes
  lda_mailbox_autosubscribe = yes

Note that if you wanted to support multiple characters for the delimiter, such as the plus sign, the hyphen, and the underscore, you could use this instead of the single recipient delimiter above,

  recipient_delimiter = +-_

Restart Dovecot,

  service dovecot restart

Listed below are the meanings of the configuration values used above as described by Dovecot Core Settings,

Default: +
The separator between the :user and :detail address parts.
Default: no
Values: Boolean
If the recipient address includes a detail element / role (as in user+detail format), save the message to the detail mailbox.
Default: no
Values: Boolean
Should LDA create a non-existent mailbox automatically when attempting to save a mail message?
Default: no
Values: Boolean
Should automatically created mailboxes be subscribed to?

Add the ManageSieve Filters

The Subaddressing ManageSieve Filter

Add the ManageSieve filter for the email address that you want to support subaddressing. The filter is as follows,

  # subaddressing rules

  require ["fileinto","subaddress","variables"];
  # rule:[subaddressing]
  if address :detail :matches "to" "*"
      set :lower "detail" "${1}";
      fileinto "INBOX.${detail}";

The instructions outlined in the sections that follow detail how to add the filter manually via SSH, however, you could alternatively add the filter via Roundcube.

Simply log into Roundcube for the email address you wish to enable subaddressing for, click Settings, then click Filters, and then click on managesieve to highlight, click Actions, then Edit Filter Set. Enter the rules as shown in the image below.

roundcube Subaddressing

Applying the Filter Globally to All Email Addresses

To create a global sieve filter so that all email accounts support subaddressing, add the sieve filter above to the file /var/lib/dovecot/sieve/default.sieve and use the sievec command line utility to compile it,

  sievec /var/lib/dovecot/sieve/default.sieve

This will create the appropriate /var/lib/dovecot/sieve/default.svbin file.

Applying the Filter to a Single Email Address

To create the rule for a single email user, edit the following file instead and compile (note that you must replace USERNAME with the actual Linux username of the DirectAdmin account, DOMAIN.TLD with the actual domain, and EMAILUSERNAME with the actual email account username),


Use this sequence of steps to correctly create and compile the rules for the single user (again, make sure to make the necessary replacements for USERNAME, DOMAIN.TLD, and EMAILUSERNAME),

  chmod 600 /home/USERNAME/imap/DOMAIN.TLD/EMAILUSERNAME/sieve
  nano /home/USERNAME/imap/DOMAIN.TLD/EMAILUSERNAME/sieve/managesieve.sieve  # add the sieve filter rules here
  sievec /home/USERNAME/imap/DOMAIN.TLD/EMAILUSERNAME/sieve/managesieve.sieve
  ln -s sieve/managesieve.sieve .dovecot.sieve
  chown USERNAME.mail  /home/USERNAME/imap/DOMAIN.TLD/EMAILUSERNAME/.dovecot.sieve

Go ahead and send a test email to test functionality. Tail the Exim log to know when it is received,

  tail -f /var/log/exim/mainlog

Upon successful receipt, you can check your email for your new email folder,

  ls -lah /home/USERNAME/imap/DOMAIN.TLD/EMAILUSERNAME/Maildir/

Applying the Filter for System Email Accounts

Alternatively, for system email accounts (those email accounts that are created automatically when you create a new DirectAdmin user account and are formatted like username@domain.tld rather than emailusername@domain.tld), you can use this command (make sure to replace USERNAME with your actual DirectAdmin username in the commands that follow!),

   ls -lah /home/USERNAME/Maildir

To add Sieve rules for system accounts, create and edit the following file for the ManageSieve rules,


You will need to do the following with this,

  mkdir  /home/USERNAME/sieve
  chmod 600 /home/USERNAME/sieve
  nano  /home/USERNAME/sieve/managesieve.sieve  # add the sieve filter rules here
  sievec /home/USERNAME/sieve/managesieve.sieve
  chown -R USERNAME.mail  /home/USERNAME/sieve/
  cd /home/USERNAME
  ln -s sieve/managesieve.sieve .dovecot.sieve
  chown USERNAME.mail  /home/USERNAME/.dovecot.*


Let’s say you send an email to testuser+testing@domain.tld. You would see the ‘testing’ mailbox listed in Roundcube under the ‘INBOX’ (due to the automatic subscription configuration setting in Dovecot) and you would see a directory structure like the following, where ‘.INBOX.testing‘ was automatically created and the email placed within it,

  [root@host1 scripts]# ls -lah  /home/USER/imap/DOMAIN.TLD/testuser/Maildir/
  total 28K
  drwxrwx--- 6 testuser mail 269 Sep 26 19:24 .
  drwxrwx--- 3 testuser mail  21 Sep 26 19:21 ..
  drwxrwx--- 2 testuser mail   6 Sep 26 19:21 cur
  -rw-rw---- 1 testuser mail  40 Sep 26 19:24 dovecot.index.log
  -rw-rw---- 1 testuser mail 912 Sep 26 19:24 dovecot.list.index.log
  -rw-rw---- 1 testuser mail  24 Sep 26 19:24 dovecot.mailbox.log
  -rw-rw---- 1 testuser mail  51 Sep 26 19:24 dovecot-uidlist
  -rw-rw---- 1 testuser mail   8 Sep 26 19:24 dovecot-uidvalidity
  -r--r--r-- 1 testuser mail   0 Sep 26 19:24 dovecot-uidvalidity.5f6fdba3
  drwxrwx--- 5 testuser mail 135 Sep 26 19:24 .INBOX.testing 
  -rw-rw---- 1 testuser mail  10 Sep 26 19:24 maildirsize
  drwxrwx--- 2testuser  mail   6 Sep 26 19:21 new
  -rw-rw---- 1 testuser mail  19 Sep 26 19:24 subscriptions
  drwxrwx--- 2 testuser mail   6 Sep 26 19:24 tmp


As of Directadmin v.1.61.5, the following feature has been added which affects the creation of email accounts that contain a plus sign in their :user portion of the :local-part of the email address:

option to block/allow plus char in new email names

This feature does not appear to affect the setup outlined in this article for enabling subaddressing when set to the default of allow_email_plus=0.