Julian Mehnle wrote:
Your filter (or filter module, if you decide to use one of the modular
frameworks) would need to check the list of envelope recipients (the
headers aren't exactly authoritative as far as actual message delivery
is concerned) for the copy address, and then either return an "accept"
or "reject" result.
[...]
It should be possible to add the copy address to the list of envelope
recipients from within a courierfilter. This can be achieved by opening
the control file in append mode and appending an additional "r" control
record[4] with the copy address. However, I'm not entirely sure this
would actually cause Courier to deliver the message to the added copy
address. (Perhaps someone on this mailing list knows better than I do?)
On a related note, you can distinguish between incoming and outgoing
messages by looking at the messages authentication information, provided
that outgoing messages are always submitted through authenticated SMTP
connections.
Currently it is not yet possible to get the authentication information
from the message control file, but you can examine the very first
"Received:" header field and look for the "AUTH" item in the second
comment field. See
http://groups-beta.google.com/group/mailing.unix.courier-imap/msg/a13130d5
ea566aea