Re: [exim-dev] Pass recipients to spamd

Top Page
Delete this message
Reply to this message
Author: Jakob Hirsch
Date:  
To: exim-dev
Subject: Re: [exim-dev] Pass recipients to spamd
(this should have gone to exim-dev...)

Ok, since nobody objected (or nobody were interested), I made a small
patch (attached) it ran fine on my system the last days.

> Looking at the code in spam.c and the spamd interface, it seems easy to
> solve this: Send the recipients in a Envelope-To (or something else,


Even easier: There's already code for it in spool_mbox.c, but it put
only a single recipient into the header ($received_for). I changed this
to $recipients. The only problem is a probably very long line, but that
seems to be no problem for spamd (at least in my tests).

> spamd recognizes it as a header belonging to the message. (The same
> could've been done for the envelope-sender, but it's not of much


Even that is already there, so the changed Received: header was not
necessary (for spamd).



--- exim-snapshot/src/spool_mbox.c
+++ exim-snapshot.jh1/src/spool_mbox.c
@@ -90,11 +90,11 @@
       };
     };
     /* Generate X-Envelope-To header */
-    envelope_to = expand_string(US"${if def:received_for{$received_for}}");
+    envelope_to = expand_string(US"${recipients}");
     if (envelope_to != NULL) {
       if (envelope_to[0] != 0) {
         uschar *my_envelope_to;
-        my_envelope_to = string_sprintf("X-Envelope-To: <%s>\n", envelope_to);
+        my_envelope_to = string_sprintf("X-Envelope-To: %s\n", envelope_to);
         i = fwrite(my_envelope_to, 1, Ustrlen(my_envelope_to), mbox_file);
         if (i != Ustrlen(my_envelope_to)) {
           debug_printf("error/short write on writing in: %s", mbox_path);