mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 11:51:05 -05:00
Postmark inbound: improve inbound parsing
- Support Postmark's RawEmail option; recommend it in docs - Handle Bcc when provided by Postmark - Obtain `envelope_sender` from Return-Path info Postmark now adds, rather than parsing Received-SPF Related: - Add `AnymailInboundMessage.bcc` convenience prop - Test against full Postmark "check" inbound payloads (which don't match their docs or real inbound payloads) - Don't warn about receiving "check" payload
This commit is contained in:
64
tests/test_files/postmark-inbound-test-payload-with-raw.json
Normal file
64
tests/test_files/postmark-inbound-test-payload-with-raw.json
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"FromName": "Postmarkapp Support",
|
||||
"MessageStream": "inbound",
|
||||
"From": "support@postmarkapp.com",
|
||||
"FromFull": {
|
||||
"Email": "support@postmarkapp.com",
|
||||
"Name": "Postmarkapp Support",
|
||||
"MailboxHash": ""
|
||||
},
|
||||
"To": "\"Firstname Lastname\" <mailbox+SampleHash@inbound.postmarkapp.com>",
|
||||
"ToFull": [
|
||||
{
|
||||
"Email": "mailbox+SampleHash@inbound.postmarkapp.com",
|
||||
"Name": "Firstname Lastname",
|
||||
"MailboxHash": "SampleHash"
|
||||
}
|
||||
],
|
||||
"Cc": "\"First Cc\" <firstcc@postmarkapp.com>, secondCc@postmarkapp.com",
|
||||
"CcFull": [
|
||||
{
|
||||
"Email": "firstcc@postmarkapp.com",
|
||||
"Name": "First Cc",
|
||||
"MailboxHash": ""
|
||||
},
|
||||
{
|
||||
"Email": "secondCc@postmarkapp.com",
|
||||
"Name": "",
|
||||
"MailboxHash": ""
|
||||
}
|
||||
],
|
||||
"Bcc": "\"First Bcc\" <firstbcc@postmarkapp.com>",
|
||||
"BccFull": [
|
||||
{
|
||||
"Email": "firstbcc@postmarkapp.com",
|
||||
"Name": "First Bcc",
|
||||
"MailboxHash": ""
|
||||
}
|
||||
],
|
||||
"OriginalRecipient": "mailbox+SampleHash@inbound.postmarkapp.com",
|
||||
"Subject": "Test subject",
|
||||
"MessageID": "00000000-0000-0000-0000-000000000000",
|
||||
"ReplyTo": "replyto@example.com",
|
||||
"MailboxHash": "SampleHash",
|
||||
"Date": "Fri, 5 May 2023 17:41:16 -0400",
|
||||
"TextBody": "This is a test text body.",
|
||||
"HtmlBody": "<html><body><p>This is a test html body.<\/p><\/body><\/html>",
|
||||
"StrippedTextReply": "This is the reply text",
|
||||
"RawEmail": "From: Postmarkapp Support <support@postmarkapp.com>\r\nTo: Firstname Lastname <mailbox+SampleHash@inbound.postmarkapp.com>\r\nSubject: Test subject\r\n\r\nThis is a test text body.\r\n",
|
||||
"Tag": "TestTag",
|
||||
"Headers": [
|
||||
{
|
||||
"Name": "X-Header-Test",
|
||||
"Value": ""
|
||||
}
|
||||
],
|
||||
"Attachments": [
|
||||
{
|
||||
"Name": "test.txt",
|
||||
"ContentType": "text/plain",
|
||||
"Data": "VGhpcyBpcyBhdHRhY2htZW50IGNvbnRlbnRzLCBiYXNlLTY0IGVuY29kZWQu",
|
||||
"ContentLength": 45
|
||||
}
|
||||
]
|
||||
}
|
||||
63
tests/test_files/postmark-inbound-test-payload.json
Normal file
63
tests/test_files/postmark-inbound-test-payload.json
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"FromName": "Postmarkapp Support",
|
||||
"MessageStream": "inbound",
|
||||
"From": "support@postmarkapp.com",
|
||||
"FromFull": {
|
||||
"Email": "support@postmarkapp.com",
|
||||
"Name": "Postmarkapp Support",
|
||||
"MailboxHash": ""
|
||||
},
|
||||
"To": "\"Firstname Lastname\" <mailbox+SampleHash@inbound.postmarkapp.com>",
|
||||
"ToFull": [
|
||||
{
|
||||
"Email": "mailbox+SampleHash@inbound.postmarkapp.com",
|
||||
"Name": "Firstname Lastname",
|
||||
"MailboxHash": "SampleHash"
|
||||
}
|
||||
],
|
||||
"Cc": "\"First Cc\" <firstcc@postmarkapp.com>, secondCc@postmarkapp.com",
|
||||
"CcFull": [
|
||||
{
|
||||
"Email": "firstcc@postmarkapp.com",
|
||||
"Name": "First Cc",
|
||||
"MailboxHash": ""
|
||||
},
|
||||
{
|
||||
"Email": "secondCc@postmarkapp.com",
|
||||
"Name": "",
|
||||
"MailboxHash": ""
|
||||
}
|
||||
],
|
||||
"Bcc": "\"First Bcc\" <firstbcc@postmarkapp.com>",
|
||||
"BccFull": [
|
||||
{
|
||||
"Email": "firstbcc@postmarkapp.com",
|
||||
"Name": "First Bcc",
|
||||
"MailboxHash": ""
|
||||
}
|
||||
],
|
||||
"OriginalRecipient": "mailbox+SampleHash@inbound.postmarkapp.com",
|
||||
"Subject": "Test subject",
|
||||
"MessageID": "00000000-0000-0000-0000-000000000000",
|
||||
"ReplyTo": "replyto@example.com",
|
||||
"MailboxHash": "SampleHash",
|
||||
"Date": "Fri, 5 May 2023 17:44:33 -0400",
|
||||
"TextBody": "This is a test text body.",
|
||||
"HtmlBody": "<html><body><p>This is a test html body.<\/p><\/body><\/html>",
|
||||
"StrippedTextReply": "This is the reply text",
|
||||
"Tag": "TestTag",
|
||||
"Headers": [
|
||||
{
|
||||
"Name": "X-Header-Test",
|
||||
"Value": ""
|
||||
}
|
||||
],
|
||||
"Attachments": [
|
||||
{
|
||||
"Name": "test.txt",
|
||||
"ContentType": "text/plain",
|
||||
"Data": "VGhpcyBpcyBhdHRhY2htZW50IGNvbnRlbnRzLCBiYXNlLTY0IGVuY29kZWQu",
|
||||
"ContentLength": 45
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user