0

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: ken+sieve@example.org

So I would like to set the my_recipient variable to be ken@example.org in order to the filter to work correctly, even when the envelope was set to ken+sieve@example.org

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?

Jacob
  • 210
  • 2
  • 8

1 Answers1

2

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";
    }
}
Jacob
  • 210
  • 2
  • 8