HaschekSolutions / opentrashmail

Open Source standalone trashmail solution that ships its own mail server
Apache License 2.0
614 stars 50 forks source link

Can't send emails from Gmail address #84

Closed dmichalski closed 4 months ago

dmichalski commented 5 months ago

I'm Running Opentrashmail 1.4.6. Unfortunately trying to send an email to Opentrashmail results in the following log output:

2024-04-27 11:53:51,904 - __main__ - DEBUG - Message addressed from: xxx@gmail.com 2024-04-27 11:53:51,904 - __main__ - DEBUG - Message addressed to: ['something@mydomain.com'] ('209.85.214.176', 47330) SMTP session exception Traceback (most recent call last): File "/usr/lib/python3.11/site-packages/aiosmtpd/smtp.py", line 753, in _handle_client await method(arg) File "/usr/lib/python3.11/site-packages/aiosmtpd/smtp.py", line 1516, in smtp_DATA status = await self._call_handler_hook('DATA') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/aiosmtpd/smtp.py", line 473, in _call_handler_hook status = await hook(self, self.session, self.envelope, *args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/www/opentrashmail/python/mailserver3.py", line 76, in handle_DATA html += part.get_payload().get_payload(decode=True).decode('utf-8') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'str' object has no attribute 'get_payload'

I can manually Telnet the SMTP server and successfully send an email. I just have port 25 exposed and no valid TLS certificate installed yet. Any ideas?

dmichalski commented 5 months ago

Ok, this is not a Gmail problem. I can reproduce the issue by using the testmail.txt from the repo. I think the problem can be boiled down to the parsing of Content Type text/html. The testmail is accepted unless I add the html part from the txt. Even the SVG is working.

baloo2 commented 4 months ago

I have the same problem with Apple iCloud emails. Here is the response from Opentrashmail SMTP server:

This is a system-generated message to inform you that your email could not
be delivered to one or more recipients. Details of the email and the error are as follows:

<[xxx@xxxx.cc](mailto:xxx@xxx.cc)>: host [mail.xxx.cc](http://mail.xxx.cc/) said: 500 Error:
   (AttributeError) 'str' object has no attribute 'get_payload' (in reply to
   end of DATA command)This is a system-generated message to inform you that your email could not
be delivered to one or more recipients. Details of the email and the error are as follows:
geek-at commented 4 months ago

confirmed and producable, working on a fix