我尝试使用Django和Mailgun通过Anymail包和OVH服务器发送邮件。
我目前收到552 sorry, your envelope sender domain must exist (#5.7.1)
错误。
在this question/answer中,建议我需要"来自"标题,但我得到的响应似乎表明标题已经包含在内:
"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')
答案 0 :(得分:1)
尝试使用covoiturage@mailgun.mydomain.fr
作为您的发件人地址,而不是covoiturage@mydomain.fr
。
我担心我不确定是否可以使用covoiturage@mydomain.fr
作为来自地址。