[Dovecot] How to rewrite header from X-Original-To to Delivered-To
Stephan Bosch
stephan at rename-it.nl
Fri May 24 15:09:13 EEST 2013
Op 5/24/2013 1:45 PM, Kiran Reddy schreef:
> Hi,
>
> If mail headers contains 2 lines Delivered-To and 1 X-Original-To. I
> want to keep first line of Delivered-To and X-Original-To and delete
> 2nd line of Delivered-To and rewrite X-Original-To to Delivered-To.
>
> Please find the mail headers as below.
>
> X-Original-To: 98862xxx65 at example.in ====> Rewrite this to Delivered-TO
> Delivered-To: mobilemail at example.in ====> KEEP This Header
> Delivered-To: example.com-mobilenumbers at example.com =======> Delete
> This Header
If you can rely on the exact order of these headers, this should work:
require "editheader";
require "variables";
if header :matches "X-Original-To" "*" {
deleteheader :index 2 "Delivered-To";
addheader "Delivered-To" "${1}";
deleteheader "X-Original-To";
}
Regards,
Stephan.
More information about the dovecot
mailing list