Open scottydawg1 opened 10 months ago
This is a known upstream issue with aiosmtpd, the SMTP library that Mailrise is using (https://github.com/aio-libs/aiosmtpd/issues/299). I've implemented the workaround identified in that thread. Try the new image (7cdfe2795e5ae282fd717104d6e133bf756d756e) and see if that resolves this for you.
Confirmed, that work around fixed it. Thanks!
Awesome! Glad it worked.
Reverting this fix because it breaks SMTP authentication.
Unfortunately, I don’t think there’s a way to fix this from Mailrise’s end. It’s aiosmtpd that’s refusing the messages.
Fair enough. I am perfectly fine with not updating my version as have no need for authentication. Thank you!
Even better: With 76e6162, the workaround will only be applied when not using SMTP authentication. 😉
I’ll keep this issue open because we really should just ignore all unknown parameters as soon as aiosmtpd lets us do that.
Hi,
the new handle_EHLO hook added with https://github.com/YoRyan/mailrise/commit/76e61628301fb2070681883fdc74bb6527107ec3 seems to cause an SMTP session exception in aiosmtpd if SMTP authentication is used:
[2024-01-14 18:27:29] INFO:mailrise.skeleton:Loaded configuration with 12 recipient(s)
[2024-01-14 18:27:29] INFO:mailrise.skeleton:TLS enabled and successfully initialized
[2024-01-14 18:27:29] DEBUG:mailrise.skeleton:Arguments for aiosmtpd: authenticator=Basic(9), auth_required=True, auth_require_tls=True, tls_context=<ssl.SSLContext object at 0x7f5d6287d2d0>, ssl_context=None, require_starttls=False
[2024-01-14 18:27:29] DEBUG:asyncio:Using selector: EpollSelector
[2024-01-14 18:28:57] INFO:mail.log:Available AUTH mechanisms: LOGIN(builtin) PLAIN(builtin)
[2024-01-14 18:28:57] INFO:mail.log:Peer: ('192.168.1.5', 46656)
[2024-01-14 18:28:57] INFO:mail.log:('192.168.1.5', 46656) handling connection
[2024-01-14 18:28:57] DEBUG:mail.log:('192.168.1.5', 46656) << b'220 mailrise.mydomain.com Mailrise 0.0.post1.dev1+g76e6162'
[2024-01-14 18:28:57] DEBUG:mail.log:_handle_client readline: b'ehlo internalclient\r\n'
[2024-01-14 18:28:57] INFO:mail.log:('192.168.1.5', 46656) >> b'ehlo internalclient'
[2024-01-14 18:28:57] ERROR:mail.log:('192.168.1.5', 46656) SMTP session exception
Traceback (most recent call last):
File "/home/mailrise/.local/lib/python3.12/site-packages/aiosmtpd/smtp.py", line 741, in _handle_client
await method(arg)
File "/home/mailrise/.local/lib/python3.12/site-packages/aiosmtpd/smtp.py", line 865, in smtp_EHLO
for r in response:
TypeError: 'NoneType' object is not iterable
[2024-01-14 18:28:57] DEBUG:mail.log:('192.168.1.5', 46656) << b"500 Error: (TypeError) 'NoneType' object is not iterable"
The hook does not seem to return anything if SMTP auth is used, but aiosmtpd replaces the response sent to EHLO with what the hook returns and expects it to be an iterable: https://github.com/aio-libs/aiosmtpd/blob/83168cdc057d9d63b6f212f330fafecb4fbfe662/aiosmtpd/smtp.py#L863-L866
I guess if SMTP authentication is used the hook should simply return the response that was passed to it as-is.
Best Regards, Salvoxia
Thanks. Reverting until I have integration tests for all of the SMTP authentication functions.
I am struggling to get one of my systems in my homelab to work. vCenter seems to be passing AUTH=<> as part of the message and mailrise is rejecting the email and returning it sender.
while talking to [IP address]: MAIL From:discord@mailrise.xyz SIZE=1459 AUTH=<> <<< 555 MAIL FROM parameters not recognized or not implemented 554 5.0.0 Service unavailable
Not sure if this is a bug or not