Ian
Ian

Reputation: 519

Sieve filter that rewrites From to Reply-To to handle Constant Contact lists

As a journalist, I deal with a lot of PR companies that use Constant Contact to send out info to their lists of writets. For years, I've built up a nice set of sieve rules that sorts these emails into my PR folder.

I guess to help with deliverability issues, Constant Contact has started rewriting the From header to the sender's address munged to end with a ccsend domain. The sender's actual email address is now in the Reply-To header. This has resulted in all my PR emails ending up in the main inbox instead of the PR folder.

Rather than rewrite hundreds of rules, I thought it might be possible to have the first sieve rule check for ccsend in the from and then rewrite the from to the reply-to so that all my old rules work. I put the following at the beginning of my roundcube.sieve file but it's not working.

if allof (header :contains "from" "ccsend") { set "from" "${reply-to}"; } #rest of rules

Upvotes: 0

Views: 270

Answers (1)

ernix
ernix

Reputation: 3643

You need to use editheader to modify mail headers.

require "editheader";
require "variables";

if address :domain :is "From" "ccsend.com" {
    if header :matches "Reply-To" "*" {
        deleteheader "From";
        addheader :last "From" "${1}";
    }
}

Upvotes: 0

Related Questions