Custom oversize rejection notice

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Custom oversize rejection notice

Kevin Miller
When someone sends an attachment via email that exceeds our limit, I'd like to return a custom error message directing them to our in-house web based file upload/download utility (similar to Dropbox in functionality).  I've looked at the bounce.cf options, but I don't see an option to address message size.  Is that a possibility?  


...Kevin
--
Kevin Miller
Network/email Administrator, CBJ MIS Dept.
155 South Seward Street
Juneau, Alaska 99801
Phone: (907) 586-0242, Fax: (907) 586-4588 Registered Linux User No: 307357


Reply | Threaded
Open this post in threaded view
|

Re: Custom oversize rejection notice

Viktor Dukhovni


> On Sep 7, 2018, at 4:04 PM, Kevin Miller <[hidden email]> wrote:
>
> When someone sends an attachment via email that exceeds our limit, I'd like to return a custom error message directing them to our in-house web based file upload/download utility (similar to Dropbox in functionality).  I've looked at the bounce.cf options, but I don't see an option to address message size.  Is that a possibility?

Oversize messages are not "bounced" by a receiving server, they are rejected.
The custom message would have to be a change in the Postfix source code that
rejects messages that exceed the message size limit.

--
        Viktor.

Reply | Threaded
Open this post in threaded view
|

Re: Custom oversize rejection notice

Bill Cole-3
On 7 Sep 2018, at 16:14, Viktor Dukhovni wrote:

>> On Sep 7, 2018, at 4:04 PM, Kevin Miller <[hidden email]>
>> wrote:
>>
>> When someone sends an attachment via email that exceeds our limit,
>> I'd like to return a custom error message directing them to our
>> in-house web based file upload/download utility (similar to Dropbox
>> in functionality).  I've looked at the bounce.cf options, but I don't
>> see an option to address message size.  Is that a possibility?
>
> Oversize messages are not "bounced" by a receiving server, they are
> rejected.
> The custom message would have to be a change in the Postfix source
> code that
> rejects messages that exceed the message size limit.

Even worse (from a customization perspective) Postfix advertises the
message_size_limit in its reply to EHLO, which many SMTP clients will
detect and honor without sending a MAIL command at all for the server to
reply to. Such clients simply disconnect and construct their own message
to pass back to the sender about the oversize mail. Nothing you do to
Postfix, even in the source code, will let you customize what the sender
sees in those cases.
Reply | Threaded
Open this post in threaded view
|

Re: Custom oversize rejection notice

Wietse Venema
In reply to this post by Kevin Miller
Kevin Miller:
> When someone sends an attachment via email that exceeds our limit,
> I'd like to return a custom error message directing them to our
> in-house web based file upload/download utility (similar to Dropbox
> in functionality).  I've looked at the bounce.cf options, but I
> don't see an option to address message size.  Is that a possibility?

Do you even know at what SMTP stage the client runs into the error?

Some SMTP clients will not even attempt to send the message when
they see the SMTP server's SIZE announcement in the EHLO response.

Some clients send a SIZE parameter in the MAIL FROM command,
in which case the SMTP server will reject the MAIL FROM command.

Some clients don't do any of the above in which case the SMTP
server will reject the message with the end-of-data response.

Either way, the smtpd_reject_footer feature may be of some help.
http://www.postfix.org/postconf.5.html#smtpd_reject_footer

Keep it short and on the same line (start with \c) and don't
expect that anyone will actually read this.

        Wietse
Reply | Threaded
Open this post in threaded view
|

RE: Custom oversize rejection notice

Kevin Miller
> Either way, the smtpd_reject_footer feature may be of some help.
> http://www.postfix.org/postconf.5.html#smtpd_reject_footer

Thanks.  I'll give that a test.  You're right, most won't ever read it.  But maybe some will.  One can hope...

...Kevin
--
Kevin Miller
Network/email Administrator, CBJ MIS Dept.
155 South Seward Street
Juneau, Alaska 99801
Phone: (907) 586-0242, Fax: (907) 586-4588 Registered Linux User No: 307357
Reply | Threaded
Open this post in threaded view
|

Re: Custom oversize rejection notice

Tom Sommer
In reply to this post by Wietse Venema
On 2018-09-08 01:21, Wietse Venema wrote:

> Either way, the smtpd_reject_footer feature may be of some help.
> http://www.postfix.org/postconf.5.html#smtpd_reject_footer

The text is wrong in the docs:

"Lookup tables, indexed by the complete Postfix SMTP server 4xx or 5xx
response, with reject footer templates. See smtpd_reject_footer_maps for
details."

Should be

"Lookup tables, indexed by the complete Postfix SMTP server 4xx or 5xx
response, with reject footer templates. See smtpd_reject_footer for
details."

?

---
Tom
Reply | Threaded
Open this post in threaded view
|

Re: Custom oversize rejection notice

Wietse Venema
Tom Sommer:
> "Lookup tables, indexed by the complete Postfix SMTP server 4xx or 5xx
> response, with reject footer templates. See smtpd_reject_footer_maps for
> details."
>
> Should be
>
> "Lookup tables, indexed by the complete Postfix SMTP server 4xx or 5xx
> response, with reject footer templates. See smtpd_reject_footer for
> details."

Fixed. Thanks.

        Wietse