使用带有 MailGun 的 Django AnyMail,MAILGUN_SENDER_DOMAIN 是否必须与 DEFAULT_FROM_EMAIL 中的域匹配?

With Django AnyMail with MailGun, does the MAILGUN_SENDER_DOMAIN have to match the domain in the DEFAULT_FROM_EMAIL?

考虑以下来自 https://github.com/anymail/django-anymailsettings.py 片段:

INSTALLED_APPS = [
    # ...
    "anymail",
    # ...
]

ANYMAIL = {
    # (exact settings here depend on your ESP...)
    "MAILGUN_API_KEY": "<your Mailgun key>",
    "MAILGUN_SENDER_DOMAIN": 'mg.example.com',  # your Mailgun domain, if needed
}
EMAIL_BACKEND = "anymail.backends.mailgun.EmailBackend"  # or sendgrid.EmailBackend, or...
DEFAULT_FROM_EMAIL = "you@example.com"  # if you don't already have this in settings

在此示例中,MAILGUN_SENDER_DOMAINDEFAULT_FROM_EMAIL 都具有域 example.com

我们最近进行了更改,使两个域不同,我似乎无法再使用 AnyMail 后端发送电子邮件。我的理论是 MailGun 'enforces' 这两个域是相同的,但我不清楚文档是否确实如此。谁能确认这是否是必需的?

我发现域不必相同。通过查看 MailGun 控制台中的日志,我注意到存在 'Not delivering to previously bounced address' 错误:

我尝试了一个不同的电子邮件地址,它成功了。