Re: [Exim] Question about having a pipe handle ALL received …

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Doug Fields
Dátum:  
Címzett: Tor Slettnes
CC: exim-users
Tárgy: Re: [Exim] Question about having a pipe handle ALL received mail
Thanks for the reply. Comments and such inline below.

On Mar 10, 2004, at 8:52 PM, Tor Slettnes wrote:
> On Mar 10, 2004, at 15:50, Doug Fields wrote:
>> However, once Exim decides to accept a message, we'd like ALL messages
>> to subsequently be delivered to a local program using the pipe
>> delivery, rather than handled by Exim in any of the usual ways. For
>> example, it might call a pipe program like this:
>>
>> delivermail <SMTP_From> <Auth_User_ID> <Remote_IP> <RCPT_TO_1>
>> <RCPT_TO_2> ...
>> for example:
>
> That said, set up a transport to do this job (e.g. 'deliver_pipe', see
> the default 'maildrop_pipe' for an example), and then create a router
> before any other routers (without any conditions) that uses this
> transport.
>
> Exim variables and expansions are available to get the parameters you
> need.  For instance:
>     $sender_address
>     $authenticated_id
>     ${lookup dnsdb{mx=$domain}fail}
>     $address_data

>
> Note that you probably either want to call this once for ALL
> recipients (in which case <Remote_IP> is ambigious), or once for EVERY
> address (in which case you will only have one RCPT_TO argument). Your
> example above is a hybrid, which will be quite a bit more complicated
> to achieve.


What we want is a robust SMTP front end to accept messages. Then, we
want every message injected into a program (as described with the pipe
transport) - but only once per message, regardless of
    a) Number of recipients (RCPT TO)
    b) Number of domains for the recipients
    c) Local/remote status for the recipients


I set up a test in the way you described, and set the pipe to use the
"use_bsmtp" option. That gave me the SMTP envelope information (from
and to addresses) inline with the message, but that's easy to parse
out. It also avoided the spurious "From" line in the beginning of the
message that would be there in an "mbox" formatted message.

It also delivered the message once regardless of if it was addressed to
one or several people and regardless of if it was to one or several
different domains. I just don't know for sure that that is what it will
always do.

The test transport looked like:

test_use_bsmtp_transport:
debug_print = "T: test_use_bsmtp_transport for $local_part@$domain"
driver = pipe
return_fail_output
command = /home/dfields/use_bsmtp-pipe sender_address $sender_address
user = dfields
batch_max = 100
use_bsmtp

And the test router, placed first, looked like: (Note that the
router/director distinction is gone in Exim 4 from 3, having just a
domains check on every router)

force_use_bsmtp:
    debug_print = "R: force_use_bsmtp for $local_part@$domain"
    driver = manualroute
    domains = ! +local_domains
    route_list = * unused_parameter
    transport = test_use_bsmtp_transport


I could just as easily turned off the "domains" line there and it would
then handle ALL mail in that fashion.

Since the route wasn't going anywhere remotely, I had no need to set
the "unused_parameter" in the route_list line. Will this harm anything?

Is there a way, in the pipe transport described above, to tell Exim
that "if the pipe process does not return success (zero result code),
attempt delivery again later?" And keep retrying it according to the
retry rules?

Then, if it ultimately chooses to fail the message, how is the DSN
e-mail handled? Will it be matched by my sample router? If so, how do I
configure a router that just handles DSN (bounce) e-mails generated by
the local Exim, for the usual SMTP delivery?

Finally, is it possible to override the use_bsmtp's configuration which
replaces a leading dot with two dots, and to tell it to skip the final
dot? The Exim 4 book seems to indicate not.

Thanks,

Doug