nodemailer / wildduck-webmail

Demo webmail service for WildDuck Mail Server
https://wildduck.email/
Other
146 stars 44 forks source link

Allow larger then 1M attachment to be sent #8

Closed bunyevacz closed 6 years ago

bunyevacz commented 6 years ago

By default nginx limits request to 1MB.

Only needs a slight configuration change in install.sh:642 https://github.com/nodemailer/wildduck/blob/master/setup/install.sh#L642

from:

    server_name $HOSTNAME;

to:

    server_name $HOSTNAME;

    # allow larger then 1M attachments
    client_max_body_size 25M;

Gmail also uses (in 2018) 25MB as a sending/receiving limit.

andris9 commented 6 years ago

You also need to increase postsize value in webmail config, which by default is "5MB"

bunyevacz commented 6 years ago

I'm about to test this modification, but postsize increase is not required.

postsize is used at one location in app.js:77-94 https://github.com/nodemailer/wildduck-webmail/blob/master/app.js#L77-L94

It sets the bodyparser middleware: https://www.npmjs.com/package/body-parser

From this page: "This does not handle multipart bodies, due to their complex and typically large nature."

And attachment is sent as :

Content-Type: multipart/form-data; boundary=---------------------------1069811382101683184696520052

I tested sending an email with and without attachments. It is always sent as multipart/form-data. I do not think this postsize limit affects anything. Maybe you can not paste a 5MB text file into the search field. I did not stress test this edge cases yet.

On the other end (gmail.com) I did receive attachments larger then 5MB (tested with 3 emails with 8-9MB attachments).

bunyevacz commented 6 years ago

I think it can be closed. The bug is fixed (nginx low default value).