Compare commits

...
Author SHA1 Message Date
holger krekel 0c8d66561b fix: allow http MX delivery to carry max-message-sized messages
it otherwise uses the 1MB nginx default body size,
forcing a fallback to SMTP (which if not available, fails the delivery)
2026-09-27 16:00:48 +02:00
2 changed files with 13 additions and 0 deletions
@@ -75,6 +75,7 @@ http {
server_name {{ config.mail_domain }} mta-sts.{{ config.mail_domain }};
location /mxdeliv {
client_max_body_size {{ config.max_message_size }};
proxy_pass http://127.0.0.1:{{ config.filtermail_http_port_incoming }};
}
@@ -5,6 +5,7 @@ import subprocess
import time
import pytest
import requests
from chatmaild.config import is_valid_ipv4
from cmdeploy import remote
@@ -326,3 +327,14 @@ def test_nginx_access_log_only_defined_once(sshdomain):
assert len(access_logs) == 1, (
f"expected 1 access_log, found {len(access_logs)}: {access_logs}"
)
@pytest.mark.filterwarnings("ignore::urllib3.exceptions.InsecureRequestWarning")
def test_mxdeliv_respects_max_message_size(maildomain, chatmail_config):
url = f"https://{maildomain}/mxdeliv"
verify = chatmail_config.tls_cert_mode == "acme"
size = chatmail_config.max_message_size
res = requests.post(url, data=b"x" * size, verify=verify)
assert res.text == "500 Invalid DATA"
res = requests.post(url, data=b"x" * (size + 1), verify=verify)
assert res.status_code == 413