[Exim] failing messages in a router for specific users

Top Page
Delete this message
Reply to this message
Author: William Thompson
Date:  
To: exim-users
Subject: [Exim] failing messages in a router for specific users
I have a router setup after the aliases have been expanded that checks to
see if the specific user is allowed to receive this size email.

The way I wrote this router looks a bit abusive of options, but appears to
work.

Here's the router:
overlimit:
        driver = redirect
        allow_fail
        domains = +local_domains
        address_data = ${lookup mysql{select max_in_email_size \
                                        from userbase.passwd \
                                        where enabled='yes' and \
                                        (email='$local_part' or \
                                         netlogin='$local_part' \
                                        ) \
                                        limit 1 \
                                     } \
                                {$value}{12m} \
                        }
        data = ${if >{$message_size}{$address_data} \
                    {:fail: $local_part@$domain can not accept email \
                     larger than $address_data\
                    } \
                    fail \
                }
        no_verify
        no_address_test