[Mimedefang] stream_by_recipient() and Postfix (was: Like action_replace_with_url(), but not quite)

Philip Prindeville philipp_subx at redfish-solutions.com
Wed Sep 12 15:21:41 EDT 2012


On 8/30/12 2:24 PM, Richard Laager wrote:
> I don't use the function, but I think the point of stream_by_recipient() is to ensure that @Recipients only has one address. (It does this by resending the message locally.) If you do that, you can munge things directly in filter(), as you never have a case of some recipients getting the attachments and some not. However, if this isn't efficient enough for you, you might just want to save state in filter() and do the streaming in filter_end if and only if you have recipients that need different handling. 

Yeah, I ended up doing something like that.

If I have any instances of the attachment type that needs rewriting and I have more than one recipient, then I set a flag that I need to "fork" this message to individual recipients, and I leave the attachment untouched (I'll get it on the 2nd pass).

If, conversely, I only have a single recipient, then I do the rewriting in filter().

If I did see the flag, then in filter_end() I call stream_by_recipient().

BTW, the return value of stream_by_recipient() isn't documented.

Also, if I'm running on a Postfix install (and I am), do I need to do anything special to use /usr/sbin/sendmail for submission?

I'm seeing:

Sep 12 11:59:13 svr001 mimedefang-multiplexor[1864]: 36AA922104B: Slave 8 stderr: Can't exec "/usr/sbin/sendmail": Permission denied at /usr/bin/mimedefang.pl line 2214.
Sep 12 11:59:13 svr001 mimedefang.pl[533]: 36AA922104B: Could not exec /usr/sbin/sendmail: Permission denied
Sep 12 11:59:13 svr001 mimedefang.pl[379]: 36AA922104B: sendmail non-zero exit status in resend_message: 256
Sep 12 11:59:13 svr001 mimedefang.pl[379]: 36AA922104B: stream_by_recipient: COULD NOT RESEND MESSAGE - PLEASE INVESTIGATE
Sep 12 11:59:13 svr001 mimedefang.pl[379]: 36AA922104B: filter:  bounce=1
Sep 12 11:59:13 svr001 mimedefang[1881]: 36AA922104B: Bouncing because filter instructed us to

when I call stream_by_recipient():

[root at svr001 mail]# ls -l /usr/sbin/sendmail
lrwxrwxrwx. 1 root root 21 Dec 28  2011 /usr/sbin/sendmail -> /etc/alternatives/mta
[root at svr001 mail]# ls -l /etc/alternatives/mta
lrwxrwxrwx. 1 root root 26 Dec 28  2011 /etc/alternatives/mta -> /usr/sbin/sendmail.postfix
[root at svr001 mail]# ls -l /usr/sbin/sendmail.postfix
-rwxr-xr-x. 1 root root 213616 Dec  2  2011 /usr/sbin/sendmail.postfix
[root at svr001 mail]# 

The man page says:

              If  you  have Sendmail 8.12, then locally-submitted messages are
              sent via SMTP, and MIMEDefang will be  called  for  each  resent
              message.  It is possible to set up Sendmail 8.12 so locally-sub-
              mitted  messages  are  delivered   directly;   in   this   case,
              stream_by_recipient() will not work.

What do I need to tweak to make this work with Postfix?  I'm running Postfix 2.6.6 and Mimedefang 2.73.

Thanks,

-Philip




More information about the MIMEDefang mailing list