2

I want to change the Message-ID header or better yet, discard it. I know everyone is going to ask "Why would you want to do that?" because I know it sounds weird to even write it.

Well I am developing a system that saves an incoming e-mail in EML format, changes it and sends it to the user, at some point the user can request to have the original EML sent to him/her. The issue is that when I re-send the EML it has the same Message-ID header which causes exchange servers to drop the re-send.

Of course I am hoping there is some option through postfix to do this, otherwise I will need to parse and change the EML but I rather not do that.

I tried to do this with "header_checks" and it works BUT I need to be able to do this conditionally, meaning only on a specific occasion, which I can identify by looking at the other headers, I want to remove the Message-ID.

masegaloeh
  • 17,978
  • 9
  • 56
  • 104
  • 1
    You may be able to use the [`header_checks`](http://www.postfix.org/header_checks.5.html) parameter. See [Remove headers](https://posluns.com/guides/header-removal/) for an example that may work. – Paul Dec 22 '14 at 16:48
  • 1
    There are plenty of questions going in the same direction. What have you tried so far? – sebix Dec 22 '14 at 17:02
  • thanks guys, I'll try the "headers_checks" I think this is the best lead so far. – in need of help Dec 23 '14 at 07:11

1 Answers1

2

I need to be able to do this conditionally, meaning only on a specific occasion, which I can identify by looking at the other headers, I want to remove the Message-ID.

No you can't do it with header_checks. Postfix examines the rules on one header line at a time. In other words, the you can't modify one header line based on another header line. See man 5 header_checks in BUG section and this thread on postfix mailing list.

Many people overlook the main limitations of header and body_checks rules.

  • These rules operate on one logical message header or one body line at a time. A decision made for one line is not carried over to the next line.
masegaloeh
  • 17,978
  • 9
  • 56
  • 104
  • Do you have another recommendation about how this can be done via postfix? Or do I have to create another script to do this prior to sending the mail? – in need of help Dec 24 '14 at 08:22
  • I'm afraid I can't help you for this. My postfix experience with header modifications was little. [This link](http://www.postfix.org/addon.html) in postfix docs wasn't help either. Well, I suggest you to write the your header modification before sending it to postfix :) – masegaloeh Dec 24 '14 at 08:42