Skip to content

Add Resend inbound handling.#462

Open
btimby wants to merge 5 commits intoanymail:mainfrom
btimby:resend-inbound
Open

Add Resend inbound handling.#462
btimby wants to merge 5 commits intoanymail:mainfrom
btimby:resend-inbound

Conversation

@btimby
Copy link

@btimby btimby commented Mar 23, 2026

@btimby
Copy link
Author

btimby commented Mar 23, 2026

Sorry for the noise, I decided to update the documentation as well. I don't plan to push anything else unless I find an error or you request changes. I did test this locally with resend and I am receiving emails, using a secret and signing key.

Copy link
Contributor

@medmunds medmunds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@btimby this looks great. And I appreciate that you added the docs. Thanks!

I have two (very minor) suggestions.

Comment on lines +409 to +410
Then, if you are using Resend's webhook signature validation (with svix),
add the webhook signing secret to your Anymail settings:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would maybe note that this is the same RESEND_SIGNING_SECRET used for tracking webhooks, so if you're using both you only need to configure it once.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I did a quick test, if I add a second webhook URL in resend.com, it is assigned a DIFFERENT signing secret. So if you use both (because the events triggering the webhooks differ) then you actually need TWO signing secrets.

Comment on lines +47 to +65
raw_mime = (
"From: Sender Name <from@example.com>\r\n"
"To: recipient@example.org\r\n"
"Subject: Testing Resend inbound\r\n"
"Date: Thu, 22 Feb 2024 23:41:11 +0000\r\n"
"Message-ID: <ABCDE12345@mail.example.com>\r\n"
"MIME-Version: 1.0\r\n"
"Content-Type: multipart/alternative; boundary=boundary\r\n"
"\r\n"
"--boundary\r\n"
"Content-Type: text/plain\r\n"
"\r\n"
"Hello, world!\r\n"
"--boundary\r\n"
"Content-Type: text/html\r\n"
"\r\n"
"<p>Hello, world!</p>\r\n"
"--boundary--\r\n"
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a style choice, but other Anymail tests typically use dedent("""\ ... """).replace("\n", "\r\n") (with a single triple-quoted string) to make inlined mime a little more readable: example.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I can follow this style.

@medmunds
Copy link
Contributor

Closes #464.

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

Successfully merging this pull request may close these issues.

2 participants