当前位置: 首页 > 知识库问答 >
问题:

Django和Mailgun:552抱歉,您的信封发件人域必须存在(#5.7.1)

缑桐
2023-03-14

我试图通过Anymail包和OVH服务器使用Django和Mailgun发送邮件。

我目前收到552抱歉,您的信封发件人域必须存在(#5.7.1)错误。

在这个问题/答案中,有人建议我需要一个“from”标题,但我得到的回复似乎表明标题已经包括在内:

    "headers": {
      "to": "evenements@mydomain-longversion.org",
      "message-id": "20160915065953.15168.46300.4ABD80EB@mailgun.mydomain.fr",
      "from": "covoiturage@mydomain.fr",
      "subject": "Mail test !"
    },

以下是完整的答复,供参考:

{
  "severity": "permanent",
  "tags": [],
  "storage": {
    "url": "https://si.api.mailgun.net/v3/domains/mailgun.mydomain.fr/messages/eyJwIjpmYWxzZSwiayI6ImI5OGIyN2QzLTM2MmEtNGJjNi05ZWViLTRlMTA0NTVmYTIxMiIsInMiOiJlNmY5NzZhZTYwIiwiYyI6InNiaWFkIn0=",
    "key": "eyJwIjpmYWxzZSwiayI6ImI5OGIyN2QzLTM2MmEtNGJjNi05ZWViLTRlMTA0NTVmYTIxMiIsInMiOiJlNmY5NzZhZTYwIiwiYyI6InNiaWFkIn0="
  },
  "delivery-status": {
    "tls": false,
    "mx-host": "redirect.ovh.net",
    "attempt-no": 1,
    "description": null,
    "session-seconds": 0.9216420650482178,
    "code": 552,
    "message": "552 sorry, your envelope sender domain must exist (#5.7.1)",
    "certificate-verified": false
  },
  "recipient-domain": "mydomain-longversion.org",
  "event": "failed",
  "campaigns": [],
  "reason": "generic",
  "user-variables": {},
  "flags": {
    "is-routed": null,
    "is-authenticated": true,
    "is-system-test": false,
    "is-test-mode": false
  },
  "log-level": "error",
  "timestamp": 1473922798.282194,
  "envelope": {
    "transport": "smtp",
    "sender": "postmaster@mailgun.mydomain.fr",
    "sending-ip": "209.61.151.224",
    "targets": "evenements@mydomain-longversion.org"
  },
  "message": {
    "headers": {
      "to": "evenements@mydomain-longversion.org",
      "message-id": "20160915065953.15168.46300.4ABD80EB@mailgun.mydomain.fr",
      "from": "covoiturage@mydomain.fr",
      "subject": "Mail test !"
    },
    "attachments": [],
    "recipients": [
      "evenements@mydomain-longversion.org"
    ],
    "size": 643
  },
  "recipient": "evenements@mydomain-longversion.org",
  "id": "TfJKwpoZQq6bM-MW5sm6nA"
}

这是我的Django代码:

def SendTestEmail(request):
    if request.user.is_staff and settings.DEBUG == True :
        send_mail(
            subject='Mail test !',
            message='''Bonjour {}, votre email a bien été envoyé.'''.format(request.user.get_full_name()),
            recipient_list=['evenements@mydomain-longversion.org',],
            from_email=settings.DEFAULT_FROM_EMAIL,
            fail_silently=False,
        )
        messages.success(request, 'Email correctement envoyé !')
    return redirect('rideshare_event_list')

共有1个答案

督阿苏
2023-03-14

尝试使用covoiturage@mailgun.mydomain.fr作为您的发件人地址,而不是covoiturage@mydomain.fr

恐怕我不确定是否可以使用covoiturage@mydomain.fr作为发件人地址。

 类似资料: