For a project I am currently working on, we received a requirement for a 'dynamic' mail attachment size limit. For postfix (which we currently use) this would be easily implemented using the
message_size_limit configuration option. This however prevents the user from sending an email with an attachment. Our use case requires for two different limits. In some situations a lower limit is applied, but this should be transparent to the users. They should still be able to send an email with an attachment which is smaller in size than the maximum limit.
So we would like to prevent a 'message-too-large' rejection mail, but instead queue the message to re-attempt delivery at a later time. So when the size limit for attachments is increased again, the mail will still get delivered to the recipient.
We need this ability for vessels which can sometimes be connected to a slow satellite uplink, and other times be connected to a high-speed uplink. For the high-speed uplink large attachments (<20MB) aren't that much of a problem, but for a very-low bandwidth satellite connection this becomes a problem, so we want to limit the attachment size. This however shouldn't be visible to the user, since he has no knowledge about the current uplink type.