Here's the setup:
iRedMail server setup to send and receive emails. (send hand crafted emails)
MailGun service to send emails. (send automated computer generated mail)
Sending mail from MailGun to mail servers other than my iRedMail server instance, are accepted.
Sending mail to my iRedMail server from MailGun, are rejected with status code 450.
Paste below shows a MailGun log entry of an email, sent by MailGun, to my iRedMail server instance.
{
"severity": "permanent",
"tags": [],
"delivery-status": {
"tls": true,
"mx-host": "m1.managemun.org",
"code": 450,
"description": "",
"session-seconds": 1.262861967086792,
"utf8": true,
"retry-seconds": 14400,
"attempt-no": 8,
"message": "4.1.8 <bounce+595546.eb6855-omar=managemun.org@mg.managemun.org>: Sender address rejected: Domain not found",
"certificate-verified": true
},
"recipient-domain": "managemun.org",
"id": "1GWMCXnjTBKo5MlCth6Faw",
"campaigns": [],
"reason": "old",
"user-variables": {},
"flags": {
"is-routed": false,
"is-authenticated": true,
"is-system-test": false,
"is-test-mode": false
},
"log-level": "error",
"timestamp": 1507644954.828214,
"envelope": {
"transport": "smtp",
"sender": "contact@managemun.org",
"sending-ip": "XXX.XXX.XXX.XX",
"targets": "omar@managemun.org"
},
"message": {
"headers": {
"to": "omar@managemun.org",
"message-id": "6be3bf88-7725-7758-e995-XXXXXXXXXXXXX@managemun.org",
"from": "ManageMUN <contact@managemun.org>",
"subject": "Password Reset"
},
"attachments": [],
"size": 1656
},
"recipient": "omar@managemun.org",
"event": "failed"
}
How can I resolve this issue?
If you have any suggestions regarding the setup, please feel free to criticise constructively
The error returned is caused by Sender Address Verification. The recipient server performs a callback to the MX records of the Sender address to verify the envelope.mail-from address <bounce+595546.eb6855-omar=managemun.org@mg.managemun.org>
.
In this case, the recipient server attempts the callback to "mg.managemun.org" but fails due to the subdomain not having MX records. Therefore, by adding Mailgun's MX records to your subdomain, mg.managemun.org, the MX lookups of those email servers will succeed, and the servers will accept your messages. The two MX records for Mailgun are or can be referenced here:
Value : mxa.mailgun.org
Priority: 10
Value : mxb.mailgun.org
Priority: 10
**Disclaimer I work at Mailgun