simplelogin-postfix-docker icon indicating copy to clipboard operation
simplelogin-postfix-docker copied to clipboard

Enabling proxy protocol breaks sl-email

Open imro2 opened this issue 1 year ago • 0 comments

When I enable proxy protocol, the sl-email container is no longer able to send email.

There are these kinds of errors in the postfix log:

sl-postfix  | Jan 27 02:35:57 mail postfix/smtpd[167]: warning: haproxy read: timeout error
sl-postfix  | Jan 27 02:35:57 mail postfix/smtpd[167]: connect from sl-email.simplelogin_sl-network[172.23.0.2]
sl-postfix  | Jan 27 02:35:57 mail postfix/smtpd[167]: disconnect from sl-email.simplelogin_sl-network[172.23.0.2] commands=0/0
sl-postfix  | Jan 27 02:35:57 mail postfix/smtp[173]: 8E91D1551: to=<[email protected]>, relay=sl-email[172.23.0.2]:20381, delay=6, delays=0.36/0.05/0/5.6, dsn=4.0.0, status=deferred (host sl-email[172.23.0.2] said: 421 SL Retry later (in reply to end of DATA command))

Errors in the sl-email:

sl-email  | 2025-01-27 03:19:59,963 - SL - DEBUG - "email_handler.py:725" - forward_email_to_mailbox() - 894cb05f-778c-49bd-991b-63b8108a6cb3 - Forward mail from [email protected] to [email protected], mail_options:['SIZE=9505'], rcpt_options:[]
sl-email  | 2025-01-27 03:20:04,969 - SL - ERROR - "email_handler.py:1625" - handle_DATA() - 894cb05f-778c-49bd-991b-63b8108a6cb3 - email handling fail [email protected] -> ['[email protected]']
sl-email  | Traceback (most recent call last):
sl-email  |   File "email_handler.py", line 1619, in handle_DATA
sl-email  |     ret = self._handle(envelope)
sl-email  |   File "email_handler.py", line 1643, in _handle
sl-email  |     ret = handle(envelope)
sl-email  |   File "email_handler.py", line 1604, in handle
sl-email  |     for is_delivered, smtp_status in handle_forward(envelope, msg, rcpt_to):
sl-email  |   File "email_handler.py", line 540, in handle_forward
sl-email  |     user,
sl-email  |   File "email_handler.py", line 736, in forward_email_to_mailbox
sl-email  |     is_forward=True,
sl-email  |   File "/code/app/email_utils.py", line 1132, in sl_sendmail
sl-email  |     smtp = SMTP(POSTFIX_SERVER, POSTFIX_PORT_FORWARD)
sl-email  |   File "/usr/local/lib/python3.7/smtplib.py", line 254, in __init__
sl-email  |     raise SMTPConnectError(code, msg)
sl-email  | smtplib.SMTPConnectError: (421, b'4.3.0 mail.germantown.club Server local error')

When I try to telnet from the sl-email container to postfix, I get

$ telnet sl-postfix 25
Trying 172.23.0.7...
Connected to sl-postfix.
Escape character is '^]'.
421 4.3.0 mail.example.com Server local error
Connection closed by foreign host.

imro2 avatar Jan 27 '25 03:01 imro2