Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recieving a NoneType error when sending a mail to its server when no subject #98

Open
tanja84dk opened this issue Mar 5, 2025 · 0 comments

Comments

@tanja84dk
Copy link

I tried to setup the docker container within my home network and have set up the A, AAAA and MX records
But when ever I try to send mails to it ( wether its Thunderbird or smtpmail or even telnet directly ), i'm then always ending with that NoneType error

It looks like it fails completely is a message doesn't have a subject which I feel should be valid

It's setup here at first with pure plaintext and port 25

This is when I try to telnet directly in to the server and send the mail directly to it

tanja@ubuntu:~$ telnet 192.168.83.12 25
Trying 192.168.83.12...
Connected to 192.168.83.12.
Escape character is '^]'.
220 labmail.home.tanja84.dk Python SMTP 1.4.6
HELO labclient.home.tanja84.dk
250 labmail.home.tanja84.dk
mail from: [email protected]
250 OK
rcpt to: [email protected]
250 OK
data
354 End data with <CR><LF>.<CR><LF>
This is a small test mail
Hope this works this time

.
500 Error: (TypeError) expected string or bytes-like object, got 'NoneType'```

And this is the traceback from within the servers container

2025-03-05 03:28:16,992 - __main__ - DEBUG - Receiving message from: ('192.168.88.5', 58872) (Plaintext)
2025-03-05 03:28:16,994 - __main__ - DEBUG - Message addressed from: [email protected]
2025-03-05 03:28:16,994 - __main__ - DEBUG - Message addressed to: ['[email protected]']
('192.168.88.5', 58872) SMTP session exception
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/aiosmtpd/smtp.py", line 756, in _handle_client
    await method(arg)
  File "/usr/lib/python3.11/site-packages/aiosmtpd/smtp.py", line 1519, 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 56, in handle_DATA
    subject = str(make_header(decode_header(message['subject'])))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/email/header.py", line 78, in decode_header
    if not ecre.search(header):
           ^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'NoneType'

@tanja84dk tanja84dk changed the title Recieving a NoneType error when sending a mail to its server Recieving a NoneType error when sending a mail to its server when no subject Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant