[Mimedefang] Adding Recipients to X-Recipients Header

Steffen Kaiser skmimedefang at smail.inf.fh-bonn-rhein-sieg.de
Wed Jun 22 03:14:51 EDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 22 Jun 2011, Marcus Schopen wrote:

>> Correct.  You can find out other recipients on YOUR mail server (or 
>> downstream), but not recipients which were handled by other servers 
>> upstream or in parallel to yours.
>
> I add the following lines to filter_end
>
>    foreach $recip(@Recipients) {
>     if ($recip =~ /<.*\@test\.com>$/i) {
>      action_add_header("X-Orig-Rcpts", "$recip");
>     }
>    }
>
> If I send an email from an external MX to BCc test at test.com and BCc
> test2 at test.com I just get an X-Orig-Rcpts for test2 at test.com. In my
> config stream_by_domain is activated in filter_begin.

Hmm, if you use stream_by_domain() already, all recipients should have the 
same domain already.

The man of stream_by_domain() says:

"
stream_by_domain() looks at all the recipients of  the  message,
               and  if  they  belong  to the same domain (e.g., 
joe at domain.com,
               jane at domain.com and sue at domain.com), it returns 0 and  sets 
the
               global  variable $Domain to the domain (domain.com in this 
exam‐
               ple.)
"

- ->

if($Domain =~ /\A(?:domain1|domain2|...)\z/i) {
 	#action_delete_all_headers('X-Orig-Rcpts'); # see below
 	action_add_header('X-Orig-Rcpts', join(', ', @Recipients));
}

BTW: If someone knows your mail setup or you forward such mails around, 
the header may contain more (or not) what you intend. Depending on your 
needs you should replace the 'X-Orig-Rcpts' header.

Regards,

- -- 
Steffen Kaiser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iQEVAwUBTgGWbP41+pMevzVSAQKBFwf8DjWFaNSCG1nbJ/+R3l8BGF+S3G6Lqt9A
R0/NPK9BLTeL15brH21Rs/oT/vToRVoUUD/b29H8nyDyJbe5LiuR+nEfpC+UUme0
lcaV4m3m32h6iDxvlFVBaADd3Do4BzXluk9lLCXk5pUzVtcOBVfHtCLB1OpZK9Ro
DgZwNxnJabJ6Rw6ZW7lnaHPBnLEXdup+eo/BgSPcZ3XlOD12VYOqryJKTM1VJ+jn
0msfb9pRo8ZSwBy+QmfYzMVZkEZmWXX7TIf/Gqc65N/d9b20hakXJIKzSv/ZFxAu
rh9KifHzxfsGN+9R02QTXMMWD9NvRy7Agqwg+q7wN/x0T0uMG3bf8A==
=aKAE
-----END PGP SIGNATURE-----


More information about the MIMEDefang mailing list