All is going well with your regular sending when an odd message appears:
What does this mean, exactly?
Essentially, it's just what the message indicates; the relaying of this email was not allowed. You could call this the "Do not pass Go, do not collect $200" of email errors.
While this is usually an authentication issue, there are 3 different common scenarios that provide some context for the bounce. The bounce message can be:
- Coming from Mailgun for outgoing emails
- Coming from Mailgun for incoming emails
- Coming from the external recipient host for outgoing emails.
So - a key element of resolving this error is finding just which instance you're experiencing.
Response from Mailgun (Outgoing)
In this scenario, you've attempted to send an email with Mailgun via SMTP, but received the Relaying Denied response during the SMTP session with Mailgun. This indicates the SMTP session was not authenticated.
Specifically, this happens when the RCPT TO command is used for an external email address before the SMTP session was authenticated.
The solution to this is to ensure your SMTP application is properly configured to authenticate, using your Mailgun SMTP credentials. We might not be able to provide exact instructions for your SMTP application, but you can find the required SMTP credentials in the domain settings page in your Mailgun control panel:
If you're using our classic UI (options across the top, with a silver background) you can follow these instructions:
- Click Domains
- Select your domain's name
- Look under Domain Information for Default SMTP Login and Default Password. You can also view custom SMTP credentials you've configured by clicking on Manage SMTP Credentials
If you're using our beta UI (options displayed down the left-hand side on a dark column):
- Click Messages
- Select your domain's name
- Click Settings
- Select SMTP Credentials
Note: All outgoing emails are required to be authenticated via SMTP or the API.
Response from Mailgun (Incoming)
In this scenario, you or a colleague has tried to send an email to an email address for which you use Mailgun Routes (how we process incoming mail). In other words - the recipient domain's MX records point to Mailgun.
In this context, the sending application will establish an SMTP session to Mailgun's MX server and issue a RCPT TO command for the recipient. If your Mailgun account does not have a route or is not properly configured to catch this recipient address, Mailgun will return a Relaying Denied error.
You'll need to check the details of your Routes and ensure your domain is properly configured to route the recipient address. We have a help article that will help you set up your Routes and ensure they are configured properly. You can check it out by clicking here.
Response from Recipient Host
In this scenario, you've successfully submitted an outgoing email to Mailgun. Mailgun then attempts to deliver the email to the recipient host, but it generates a failed event with the Relay Denied message.
This bounce message is being returned by the external recipient host and not Mailgun in this scenario. It typically means the email address is invalid. The recommended action is to double check the recipient email address is correct.
If you have any questions, please open reach out to our Support team via the Support tab in your Mailgun control panel - our team will be happy to assist!