著者: W B Hacker 日付: To: exim users 題目: Re: [exim]
Limit outgoing mail based on size + CC’s
b-boy wrote: > Hi all
>
> I have very limited bandwidth and I would like to setup my Exim box to delay
> all mails if they are larger than a certain size (let’s say 10megs for the
> sake of this question) this rule should also take into account cc’s and
> bcc’s so if someone sends a 1meg mail to 10 recipients it should be frozen
> till afterhours and then only delivered.
>
> And there is a complication, my Exim configuration splits the mail into its
> individual mails i.e. a user sends a mail with 10 cc’d addresses Exim will
> split it into 10 mails (there is no way around this, I have a special
> application that will only work like this )
>
> I have found solutions for limiting large mails using a router
>
> defer_if_large_unless_queue_run:
> driver = redirect
> condition = ${if or{{queue_running}{<{$message_size}{200K}} }{no}{yes}}
> allow_defer
> data = :defer: too large for immediate delivery
> no_verify
>
> And I know you can do the same for the number of recipients but I have no
> idea how to combine the two to do what I would like it to do.
>
> Please help :)
> B
>
Might not be so hard.....
Any 'acl_m' variable accompanies the 'administrative' information about
a message into (its own part of) the queue - whether one copy 'to be
Xeroxed and distributed' later, or already-duplicated and
multiple-copy-stored (if that is what you are actually doing).
Either way, if either a true/false or 1/0 'flag' has been written into
an acl_m variable OR an integer or string, your router/transport sets
can read (but no longer write to) that variable and modify their behaviour.
You need to do two things;
- set the acl_m indicator in an acl_smtp_data phase acl clause (easy).
- configure a router to ignore it and leave it on the queue if
time-of-day is 'not yet'. Harder - if only infrequently done, and I
haven't seen examples recently. May or may not need to be a manualroute
router.
There may be another way.
It is not unhead of to configure Exim to not make *any* off-box
deliveries until a specified time or event (think dial-up).
If you were to run two Exim instances, one with 'ordinary' rules
listening to the outside world on port 25, the other with 'only after
hours' rules on an internal-only IP, then a router in the first could
see the flag, and relay the marked messages to the second over smtp, or
lmtp, finding it via a manual mapping in /etc/hosts.