Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

When I try to send an email (from a different server) to a local account on my server I get the following error:

Relaying denied. IP name possibly forged [W.X.Y.Z]

Here's what I do:

user@a-different-domain.com:~$ telnet subdomain.domain.com 25
Trying A.B.C.D...
Connected to subdomain.domain.com.
Escape character is '^]'.
220 subdomain.domain.com ESMTP Sendmail 8.14.4/8.14.4/Debian-2ubuntu1; ...
HELO a-different-domain.com
250 subdomain.domain.com Hello ...
MAIL FROM: <user@a-different-domain.com>
250 2.1.0 <user@a-different-domain.com>... Sender ok
RCPT TO: <user@subdomain.domain.com>
550 5.7.1 <user@subdomain.domain.com>... Relaying denied. IP name possibly forged [W.X.Y.Z]

The problem is that I can send emails just fine if I use RCPT TO: <user@mail.subdomain.domain.com> instead of RCPT TO: <user@subdomain.domain.com>

Please see below the configuration that I currently use.

DNS Configuration:

Host                 Type  Priority  Redirect to
subdomain.domain.com MX    10        mail.subdomain.domain.com
subdomain.domain.com A     10        A.B.C.D

Email server configuration:

OS: Ubuntu
Email Server: sendmail

In /etc/mail/access I have (among others):




Regarding the masquerading here is what I have in /etc/mail/sendmail.mc:


Just for clarifications: mail.subdomain.domain.com and subdomain.domain.com point to the same IP address.

================= UPDATE1 =================

@Andrzej A. Filip

Yes, i restarted sendmail.

Here is the output of echo '$=w' | sendmail -Am -bt:

root@subdomain:/etc/mail# echo '$=w' | sendmail -Am -bt
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> [A.B.C.D]

================= UPDATE2 =================

I tested and found out (without changing the DNS configuration) that if i add subdomainXXX.domain.com (where subdomainXXX is any string) to /etc/mail/local-host-names and then I test sending an email from a remote server it simply works:

user@remote-server:/# telnet subdomain.domain.com 25
Trying A.B.C.D...
Connected to subdomain.domain.com.
Escape character is '^]'.
220 subdomain.domain.com ESMTP Sendmail 8.14.4/8.14.4/Debian-2ubuntu1; ...
HELO remote-server
250 subdomain.domain.com Hello ....
MAIL FROM: <...>
250 2.1.0 <...>... Sender ok
RCPT TO: <root@subdomainXXX.domain.com>
250 2.1.5 <root@subdomainXXX.domain.com>... Recipient ok

So it works for any subdomain except for the one that I'm interested into (subdomain.domain.com - which is actually the hostname of the server).

share|improve this question
Can you also provide us with the contents of /etc/hosts? –  adamo Mar 16 '13 at 0:13
Here's the content of /etc/hosts: ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters localhost.localdomain localhost subdomain.domain.com # Auto-generated hostname. Please do not remove this comment. A.B.C.D subdomain.domain.com subdomain –  Razvan Mar 16 '13 at 0:45

3 Answers 3

"Relaying denied"suggets that sendmail at mail.subdomain.domain.com does not treat subdomain.domain.com as a local email domain, email domain hosted by it.

Have you restarted/reloaded sendmail server after modifying /etc/mail/local-host-name file at mail.subdomain.domain.com host?

YES=> What is reported by the command below exececuted by root at mail.subdomain.domain.com host?

echo '$=w' | sendmail -Am -bt
share|improve this answer
I replied to your comment in my original question. Thank you. –  Razvan Mar 15 '13 at 17:48
Could you double check lack of mistakes in masquerading real DNS/host names? Are subdomain.domain.com and mail.subdomain.domain.com different host? You want mail.subdomain.domain.com handle email for subdomain.domain.com and complain that subdomain.domain.com refuses email for eail domain it should not handle as local. BTW /etc/mail/access requires "KEY VALUE" line format and makemap compilation. –  Andrzej A. Filip Mar 15 '13 at 18:28
1. subdomain.domain.com and mail.subdomain.domain.com point to the same IP. 2. I don't want mail.subdomain.domain.com to handle emails for subdomain.domain.com - I would like for subdomain.domain.com to handle emails on its own (but I just didn't know how to set up MX records differently). So, from my point of view I don't even need mail.subdomain.domain.com. –  Razvan Mar 15 '13 at 19:14
In theory you would not need MX record at all. In practice some mail servers are picky about email with sender from domain/host without MX record. Try to eliminate mail.subdomain.domain.com fro DNS - subdomain.domain.com MX 10 subdomain.domain.com –  Andrzej A. Filip Mar 15 '13 at 20:20
Ok, thanks for the suggestion. I updated the DNS records but I believe I have to wait up until to one hour. Still, do you think could help? I see it more like local thing: for some reason sendmail does not see itself as subdomain.domain.com (even though it is configured in local-host-names). –  Razvan Mar 15 '13 at 20:40
up vote 0 down vote accepted

And .. after several hours I found the issue:

localhost.localdomain needs to be put alongside with subdomain.domain in /etc/mail/local-host-names.

So, the correct content for /etc/mail/local-host-names should be:


It does NOT WORK if you only use:

share|improve this answer

I had a look at my sendmail.cf. The error message that you give Relaying denied. IP name possibly forged happens in the Relay_ok rule set. Relay_ok is executed by Basic_check_rcpt, which in turn is executed by checkrcpt which in turn is executed by check_rcpt (confusing, I know). The error happens when the value for $&{client_resolve} is FORGED which means that the forward lookup does not match the reverse DNS lookup.

So the question is: If all you change is either including or removing localhost.localdomain from /etc/mail/local-host-names, why does Relay_ok rejects or accepts email based on this fact? The interesting lines in Relay_ok is:

R$*                     $: $&{client_addr}
R$*                     $: < $&{client_resolve} >

When localhost.localdomain is not included in /etc/mail/local-host-name we get a <FORGED> reply from $&{client_resolve}. When it is included, we do not get this. So the decision about relaying happens before calling Relay_ok. This means that Rcpt_ok (again called in Basic_check_rcpt before Relay_ok) decides that.

Now from the description that the OP gives, Ubuntu sendmail seems to not automatically include names in /etc/hosts into $=w and that is why localhost.localdomain needs to be included specifically. But why?

[ Had the original poster posted the complete sendmail.mc it would have helped a lot ]

share|improve this answer
I put the complete sendmail.mc on PasteBin: pastebin.com/a5nX62FB –  Razvan Mar 17 '13 at 11:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.