Operating System & Version
CentOS Linux release 7.8.2003 (Core)
cPanel & WHM Version
11.86.0.21

amerhamid

Member
May 20, 2020
5
0
1
Rawalpindi, Pakistan
cPanel Access Level
Root Administrator
I have a GCE instance with cpanel installed on CentOS 7 and mailgun configured as a SMTP handler on port 2525.

Generally it is working fine but the strange problem i am facing with subsequent emails.

For instance, if i send two subsequent emails to [email protected] from [email protected] (xyz is a domain on host) with an interval of few seconds or may be a minute, most probably 1st will go thru and 2nd will end up with error "550 5.7.1 Relaying denied" - in some cases 1st one ends up with same error and 2nd goes thru, at times both end up with error or both goes thru. The behaviour is not stable.

Any help would be highly appreciated.
 

cPSamuel

Well-Known Member
Staff member
Nov 20, 2019
71
13
83
USA
cPanel Access Level
Root Administrator
Hello @amerhamid

Thank you for contacting cPanel!

Based on a StackOverflow post I found, the "550 5.7.1 Relaying denied" error when using Mailgun can mean that one of several criteria might not have been met.

https://stackoverflow.com/a/46713741

Note, later in the same StackOverflow topic, I see that a user said the Mailgun tutorial on our site is misleading. Specifically, the following line:

Code:
hide client_send = : EMAIL-USED-FOR-MAILGUN-SIGNUP:YOUR-MAILGUN-PASSWORD

This line should be updated to use your Mailgun SMTP credentials, as opposed to your Mailgun account credentials.

Please review the information provided in those posts and ensure your configuration is set up properly. If you continue to receive error messages, it may be easier for us to assist you with troubleshooting if you submit a ticket using the link in my signature.
 
  • Like
Reactions: amerhamid

amerhamid

Member
May 20, 2020
5
0
1
Rawalpindi, Pakistan
cPanel Access Level
Root Administrator
Hi @cPSamuel

Thank you so much for your kind reply. I am glad to see someone at least care to help and bothered to reply.

Now getting back to topic, I have two comments:

1) [hide_client_send] is properly configured with SMTP credentials and not the mailgun account credentials.
2) If there was something wrong with the authentication credentials and/or SMPT settings then all emails should have been denied/rejected but in my case some emails go thru successfully and other not. In fact there are cases where email from same sender/recipient once went thru successfully and rejected with subject error on subsequent email a few minutes or seconds later.

I would appreciate having your comments on this behaviour. Regards.
 

cPSamuel

Well-Known Member
Staff member
Nov 20, 2019
71
13
83
USA
cPanel Access Level
Root Administrator
Hello again @amerhamid

You are very welcome! I would encourage you to submit a ticket so we can review this issue in greater detail. Without specific details about the Mailgun smarthost configuration on your server, or the recipients you are sending to when you encounter this problem, we can only speculate. Submitting a ticket would allow you to share these details without making them public in these forums.

The issue may be related to the configuration of the smarthost on your server, or at the smarthost itself, or it even may be due to the configuration of the recipient's mail server or DNS. Generally the "relaying denied" error means that the message has arrived on a server that does not manage mail for the recipient address, and it refuses to redirect the mail to the server it thinks manages that address. If you are receiving this error message intermittently when sending to one specific address, then being able to review your server's mail logs may help us gather more information about the issue.
 

Eddie C

Registered
May 25, 2020
1
0
1
United Status
cPanel Access Level
Root Administrator
I have exactly the same issue as yours. Here is the solution worked for me:
1. Telnet smtp.mailgun.org 2525
Copy all possibility IP address, please redo this 3-10 times to make sure your copy all IPs.
2. Add those IPs to /etc/hosts. Adding each IP to this file. (Mailgun has many IPS about 10 IPs.)

After this you should able resolve the problem. But this will occurred if Mailgun assign to new IP to itself, you need to manually add it again to /etc/hosts.
This is annoying, and is a pain to me.
For some reason, If I delete all Mailgun IPs from my /etc/hosts list it will occurred "550 5.7.1 Relaying denied".
I am hoping here someone could help me to solve my problem.

Thanks,
 

amerhamid

Member
May 20, 2020
5
0
1
Rawalpindi, Pakistan
cPanel Access Level
Root Administrator
Hello again @amerhamid

You are very welcome! I would encourage you to submit a ticket so we can review this issue in greater detail. Without specific details about the Mailgun smarthost configuration on your server, or the recipients you are sending to when you encounter this problem, we can only speculate. Submitting a ticket would allow you to share these details without making them public in these forums.

The issue may be related to the configuration of the smarthost on your server, or at the smarthost itself, or it even may be due to the configuration of the recipient's mail server or DNS. Generally the "relaying denied" error means that the message has arrived on a server that does not manage mail for the recipient address, and it refuses to redirect the mail to the server it thinks manages that address. If you are receiving this error message intermittently when sending to one specific address, then being able to review your server's mail logs may help us gather more information about the issue.
Hi @cPSamuel

I have change the email provider from mailgun to smtp2go and after this change there are no problems. So one thing is for sure there was nothing wrong in server/whm setup. Now I have opened a support ticket with mailgun and working with them to sortout the issue with their service.

once again thank you very much :)
 

amerhamid

Member
May 20, 2020
5
0
1
Rawalpindi, Pakistan
cPanel Access Level
Root Administrator
I have exactly the same issue as yours. Here is the solution worked for me:
1. Telnet smtp.mailgun.org 2525
Copy all possibility IP address, please redo this 3-10 times to make sure your copy all IPs.
2. Add those IPs to /etc/hosts. Adding each IP to this file. (Mailgun has many IPS about 10 IPs.)

After this you should able resolve the problem. But this will occurred if Mailgun assign to new IP to itself, you need to manually add it again to /etc/hosts.
This is annoying, and is a pain to me.
For some reason, If I delete all Mailgun IPs from my /etc/hosts list it will occurred "550 5.7.1 Relaying denied".
I am hoping here someone could help me to solve my problem.

Thanks,
Hi @Eddie C,

Thank you very much for suggesting a solution and driving me in right direction. Definitely i'll try it and update this thread with the results. Thanks and Regards :)