When a rule or external helper uses the AddHeader action, this information is not written to the file immediately, and other helpers don't have access to them. There should be a way, a special question the helper could ask to a special answer to the INTF command that would make CGP provide that information to the helper for each file it has to process.
For instance:
S> 1 INTF 4
H> 1 INTF 4 "HEADERS"
S> 2 FILE "Queue/1234567.msg" "SomeHeader: SomeValue\eSomeOtherHeader: SomeOtherValue..."
H> 2 OK
This solution is perhaps a problem since the headers can be arbitrary long. Another solution would be a special question asked by the helper:
S> 1 INTF 4
H> 1 INTF 4
S> 2 FILE "Queue/1234567.msg"
H> 2 HEADERS?
S> 2 HEADERS 57 (the length to read after the next CR/LF)
S> SomeHeader: SomeValue
S> SomeOtherHeader: SomeOtherValue...
Or any other solution that you can come up with and would allow helper to read info about the headers.
While you're doing this, it would perhaps be a good idea to extend that additional information with an documented and fixed way to read the envelope information. We all know several filters read and rely on the envelope information format at the beginning of .msg files, but this format is undocumented and said to be subject to changes. An official API to get that information, along with the additional headers, would be very welcome.
To allow mail proxies or backup mail servers to query the main CGP server and ensure a consistent protection of the mail flow, without duplicating the settings or reimplementing them. A CLI command (requires MASTER right) such as
GETSMTPEXPECTEDRESPONSE IPFROM 1.2.3.4 SENDER sen...@example.com RECIPIENTS (recip...@example.com,recip...@example.com) SIZE 55984
CGP would consider the IP in its network settings (client IP, blacklists, SPF, RBL), the sender as unauthenticated, the recipients (relay, etc), the message size, and any other thing that could make CGP refuse, delete or spamtrap the message before the DATA command of the SMTP session - so sync rules are not involved.
Nicolas Hatier <nicolas...@niversoft.com>
Niversoft idées logicielles - http://www.niversoft.com