We have a postfix server configured with message_size_limit=10240000
(the default) and I would now like to prevent the creation of any mail that is bigger than that. Because I get otherwise a "connection broken" error, which is difficult to present to the user in a meaningful error message.
The definition of message_size_limit
is:
The maximal size in bytes of a message, including envelope information.
My question is: How can I calculate / predict / estimate the size in bytes of a created mail with lots of different attachments? javax.mail.Message.size()
is only available when receiving a mail.