I currently have a sieve filter that looks like the following:

require ["variables", "envelope", "fileinto", "vnd.dovecot.filter", "subaddress"];
if envelope :matches "to" "*" {
        set :lower "my_recipient" "${1}";
        filter ".." "${my_recipient}";
        fileinto "INBOX";

This works great. However my filter current is unable to correctly handle sub-addresses such as: [email protected]

So I would like to set the my_recipient variable to be [email protected] in order to the filter to work correctly, even when the envelope was set to [email protected]

I have read through the subaddress documentation, and I can see how to get i.e the user part or the domain part, but not how to get the full address including domain without the detail part. How could I achieve that?

1 Answer 1


The following works

if envelope :user :matches "to" "*" {
    set :lower "user" "${1}";
    if envelope :domain :matches "to" "*" {
        set :lower "domain" "${1}";
        set "my_recipient" "${user}@${domain}";
            filter ".." "${my_recipient}";
            fileinto "INBOX";

You must log in to answer this question.

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