Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ vNext
Fixes
~~~~~

* **Postmark:** Fix spurious AnymailInvalidAddress in ``message.cc`` when
inbound message has no Cc recipients. (Thanks to `@Ecno92`_.)

* **Postmark:** Workaround for handling inbound test webhooks.
(`More info <https://github.com/anymail/django-anymail/issues/304>`__)

Expand Down Expand Up @@ -1428,6 +1431,7 @@ Features
.. _@dgilmanAIDENTIFIED: https://github.com/dgilmanAIDENTIFIED
.. _@dimitrisor: https://github.com/dimitrisor
.. _@dominik-lekse: https://github.com/dominik-lekse
.. _@Ecno92: https://github.com/Ecno92
.. _@erikdrums: https://github.com/erikdrums
.. _@ewingrj: https://github.com/ewingrj
.. _@fdemmer: https://github.com/fdemmer
Expand Down
5 changes: 4 additions & 1 deletion anymail/inbound.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ def get_address_header(self, header):
"""
values = self.get_all(header)
if values is not None:
values = parse_address_list(values)
if "".join(values).strip() == "":
values = None
else:
values = parse_address_list(values)
return values or []

def get_date_header(self, header):
Expand Down
4 changes: 2 additions & 2 deletions anymail/message.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from email.mime.image import MIMEImage
from email.utils import unquote
from email.utils import make_msgid, unquote
from pathlib import Path

from django.core.mail import EmailMessage, EmailMultiAlternatives, make_msgid
from django.core.mail import EmailMessage, EmailMultiAlternatives

from .utils import UNSET

Expand Down
6 changes: 6 additions & 0 deletions tests/test_inbound.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,12 @@ def test_address_props(self):
self.assertEqual(msg.to, [])
self.assertEqual(msg.cc, [])

# Empty strings
msg = AnymailInboundMessage.construct(from_email="", to="", cc="")
self.assertIsNone(msg.from_email)
self.assertEqual(msg.to, [])
self.assertEqual(msg.cc, [])

def test_body_props(self):
msg = AnymailInboundMessage.construct(text="Test plaintext", html="Test HTML")
self.assertEqual(msg.text, "Test plaintext")
Expand Down