You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I currently evaluate Anymail in my Django project to integrate with Mailgun to be able to process inbound mails via Mailgun routes and the webhook of Anymail and to send mails via Mailgun.
The Mailgun API security distinguishes between a "Private API key" and a "HTTP webhook signing key" which are different.
According to the Anymail documentation, the Mailgun ESP needs to be provided the ANYMAIL_MAILGUN_API_KEY setting which takes the Mailgun "Private API key".
However, if ANYMAIL_MAILGUN_API_KEY is the "Private API key", the verification of inbound mail via the webhook fails
Webhook HTTP requests from Mailgun are signed with the "HTTP webhook signing key"
Proposal
Define a new setting ANYMAIL_MAILGUN_SIGNING_KEY which must be configured with the "HTTP webhook signing key" when using the inbound mail functionality
MailgunBaseWebhookView should take the key to verify the signature from ANYMAIL_MAILGUN_SIGNING_KEY
(Kind of) workaround
Depending on which API key is provided to ANYMAIL_MAILGUN_API_KEY, either inbound mails from Mailgun ESP or send mails via Mailgun ESP works, but not both
To allow inbound mails, set ANYMAIL_MAILGUN_API_KEY to the "HTTP webhook signing key"
To allow sending mails, set ANYMAIL_MAILGUN_API_KEY to the "Private API key"
Some notes
Before opening this issue, I have carefully scanned the Anymail documentation but was not able to find a hint
Description
ANYMAIL_MAILGUN_API_KEYsetting which takes the Mailgun "Private API key".ANYMAIL_MAILGUN_API_KEYis the "Private API key", the verification of inbound mail via the webhook failsProposal
ANYMAIL_MAILGUN_SIGNING_KEYwhich must be configured with the "HTTP webhook signing key" when using the inbound mail functionalityMailgunBaseWebhookViewshould take the key to verify the signature fromANYMAIL_MAILGUN_SIGNING_KEY(Kind of) workaround
ANYMAIL_MAILGUN_API_KEY, either inbound mails from Mailgun ESP or send mails via Mailgun ESP works, but not bothANYMAIL_MAILGUN_API_KEYto the "HTTP webhook signing key"ANYMAIL_MAILGUN_API_KEYto the "Private API key"Some notes
Environment