【问题标题】:Anymail Mailgun ErrorAnymail Mailgun 错误
【发布时间】:2026-01-14 09:55:02
【问题描述】:

我正在尝试将 django-anymail 与 mailgun 集成。当我使用 django send_mail 发送邮件时

send_mail('Testing', 'Test dsadsadsa asdsa body', 'xyz@mailinator.com', ['xxxx@gmail.com'])

它给出了一个错误:

AnymailRequestsAPIError: Sending a message to xxxx@gmail.com from xyz@mailinator.com
ESP API response 404:
{
  "message": "Domain not found: mailinator.com"
}

我怎样才能摆脱这个?

我的设置文件包含以下内容:

ANYMAIL = {
    "MAILGUN_API_KEY": "key-xxxmyprivatekey",
}
EMAIL_BACKEND = "anymail.backends.mailgun.MailgunBackend"
DEFAULT_FROM_EMAIL = "no-reply@mailinator.com"

【问题讨论】:

  • 看起来像 this question 的副本。此外,您可能不应该欺骗mailinator.com 地址。
  • 试过这个。还是行不通。它给出“消息”:“找不到域:mg.mailinator.com”

标签: django django-anymail


【解决方案1】:

听起来您尚未在 Mailgun 中验证您的发送域。 Anymail 直接从您的 ESP Mailgun 报告 API 错误,它抱怨他们找不到您尝试发送的域。

登录您的 Mailgun 帐户并在其仪表板中查看 domains list。那里列出的 mg.mailinator.com 是否带有绿色“活动”徽章?如果没有,请根据需要添加,然后按照 Mailgun 的说明发送至verify the domain

【讨论】: