Mailing List Message #92238
From: Bret Miller <>
Subject: RE: Do not understand headers in the messages on Queue Folder
Date: Wed, 15 Aug 2007 13:57:32 -0700
To: CommuniGate Pro Discussions <>
X-Mailer: CommuniGate Pro MAPI Connector 1.2.12/1.2.12(local)
> I wanna to write a script to reject the mail from some domain
> users who only
> have permission to send to restricted destinations.
> The problem is:     CGate passes it SEQNUM and FILE
> But when the user add two or more destinations in the same
> message only ONE
> message is encountered on Queue folder.
> The message headers are something like that:
> P I 15-08-2007 20:06:32 0000 ____ ____ <>
> R W 15-08-2007 20:06:32 0000 ____ _FY_ <>
> R T 15-08-2007 20:07:08 0000 ____ _FY_ <>
> I guess "P" means the source, and "R" the destinations...but
> who the Filter
> know how and how to tell to CGate to reject the message for
> one destination and leave for others.

The official answer is, you can't do that. You either must accept the entire
message with all its recipients or reject the entire message with all its

First, the disclaimer: the CGPro header format is officially undocumented,
and while it has been supplied from time to time, it could be subject to
change in any new release. So, anything you do with those is officially
unsupported. And, any ideas I supply herein are simply theory that might
work in the current version with appropriate coding, or might not; and might
cease to work in any new version.

Yes, the P line is the supplied return-path or (mail from) from the protocol
conversation, and R lines are the recipients as specified in the rcpt to
from the protocol conversation. When you must act differently on different
recipients, you have but one choice-- discard the original message and
re-insert it. The effects of doing this are that you lose any headers
previously added by rules, and the message will start over through the
enqueuing process.

The most common, and least subject to the disclaimer is to use the PIPE
module to re-insert the message. Essentially, that means removing the CGPro
headers, generating Return-Path and Envelope-To headers at the top of the
message, and moving the new message file to the Submitted directory. Using
this method adds an additional Received header to the message indicating
that it was inserted by the PIPE module, and removes attributes like the
source IP address and whether the sender is trusted (in your client IP
range) or authenticated. This might or might not matter as long as you're
aware that you can't use those conditions on the resulting messages for
rules that execute later.

Another possibility, though largely unused at the moment, would be to
reinsert using the ForeignQueue directory. To do this, you'd need to strip
only the recipient lines you didn't want and keep all the other CGPro
headers. Doing this should retain the original message properties.
ForeignQueue isn't designed for this application. It's designed to reinsert
messages that have been rescued from a queue of another failed server or
perhaps removed from the queue manually to stop a crashing external filter
module. In
spite of not being designed for this, ForeignQueue offers advantages over
PIPE processing for applications that need to "split" a message into sets of

With any discard and reinsert system, you have to code appropriately so you
don't get into a loop discarding and reinserting the same message.


Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster