Mailgun Server response: 550 Sender rejected

跟風遠走 提交于 2019-12-11 04:35:42

问题


Recently I ran into a problem trying to send email using the mailgun API because mailgun uses the domain registered with mailgun in the 'sender' field for the email 'envelope' map.

The failed response error message I got was:
Server response: 550 postmaster@mg.example.com Sender rejected

I followed the directions in the mailgun documentation for verifying my domain and used the recommended best practice of creating the 'mg' subdomain for my mailgun email routing. After adding the text records, I was able to send email using the smtp method through a gmail alias, however whenever I tried to send an email using the same reply-from address, it failed.

After further investigation, I noticed that it does not fail when I send an email to a gmail account, but it does fail when I try to send the email to an account hosted by mydomain.com.


回答1:


The problem turns out to be that certain email servers will first check that the subdomain specified in the sender email hostname have a MX record that is active. This check appears to be a part of internet standards and exist in order to combat spam. However it is used by some but not all email servers... gmail does not seem to perform this verification so emails to gmail addresses did not get rejected.

Because the mailgun api adds whichever domain is registered and verified with mailgun in the 'sender' field, my emails were being rejected by mydomain.com because there was no MX record for that subdomain.

I fixed the problem by going to my DNS and adding the MX record for the subdomain mg.example.com and it started to work once the record changes were propagated.

In the fourth item of the verification process, mailgun does suggest that an MX record be added for your domain. However, my mistake seems to have been to think that an MX record attached to the root domain would cover the subdomain. A separate MX record must also be setup for the subdomain.



来源:https://stackoverflow.com/questions/45923561/mailgun-server-response-550-sender-rejected

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!