anymail / django-anymail

Django email backends and webhooks for Amazon SES, Brevo (Sendinblue), MailerSend, Mailgun, Mailjet, Postmark, Postal, Resend, SendGrid, SparkPost, Unisender Go and more
https://anymail.dev
BSD 3-Clause "New" or "Revised" License
1.67k stars 129 forks source link

Postmark inbound test email can not be parsed #304

Closed Ecno92 closed 1 year ago

Ecno92 commented 1 year ago

It seems like the inbound test email from postmark can not be parsed by anymail

After pressing the check button in postmark:

Screenshot from 2023-04-03 15-34-29

Some debugging

(Pdb) esp_event.get("Attachments", [])
[{'Name': 'test.txt', 'ContentType': 'text/plain', 'Data': 'VGhpcyBpcyBhdHRhY2htZW50IGNvbnRlbnRzLCBiYXNlLTY0IGVuY29kZWQu', 'ContentLength': 45}]

I checked the developer guide by postmark and it seems like anymail is doing the right thing. The documentation also mentions Content, but in my case I'm seeing a Data key.

I'll follow up to figure out what's causing this issue. It might be an issue at Postmark, but given that the view crashes as a result of it I'll report it here first.

Ecno92 commented 1 year ago

Got confirmation that this is an issue on the Postmark side and that they are working on it.

medmunds commented 1 year ago

Thanks for following up with Postmark on this. I reported the same issue to them about a year ago.

Postmark's actual inbound payloads use a Content key in attachments (matching their documentation, and Anymail's implementation). But their (hardcoded) sample payload incorrectly uses a Data key.

I'm thinking Anymail should maybe allow either key, just in case it takes a while for them to release a fix.

Ecno92 commented 1 year ago

That puts things in a different perspective. I just had contact with them and they will keep me informed about any fix. They do not expect it very soon, because there is a workaround available. You can just send a real email to get a correct POST to your endpoint.

I will continue testing with real data tomorrow. This will allow me to understand how the current implementation works and finish the implementation for my client.

Normally I would not be in favor of workarounds like this, but given that it might take "another year" I think it is not a bad idea to implement.

I'll try to come back to this by the end of this week whether I can pick this up.

Update 2023/04/11: I'm trying to pick this up, but I expect that it might take some time as I'm quite busy during the upcoming weeks.