[Mimedefang] Like action_replace_with_url(), but not quite

David F. Skoll dfs at roaringpenguin.com
Thu Aug 30 23:21:05 EDT 2012


On Fri, 31 Aug 2012 10:54:00 +0900
Nathan Findley <nathan at zenlok.com> wrote:

>  From our more knowledgeable mimedefang users, I would appreciate an 
> explanation about what is happening in the mimedefang.pl 
> "resend_message_specifying_mode" method. The child execs sendmail.
> The message data is sitting in the child process's STDIN, correct?

Nope.  The real magic happens here:

    $pid = open(CHILD, "|-");

This forks a process and connects STDIN of the child process to the
CHILD descriptor in the parent.

> { exec($sm, @cmd); } <-- how is sendmail receiving the contents of
> the message? I don't see any explicit piping happening.

Whatever the parent process writes to the CHILD descriptor shows up on
STDIN of the child.  As in:

    if ($pid) {   # In the parent -- pipe mail message to the child
        print CHILD $body;
        close(CHILD);
        return;
    }

And you can stream messages in filter_end if you like.

Regards,

David.



More information about the MIMEDefang mailing list