Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:$ telnet 25
Trying A.B.C.D...
Connected to
Escape character is '^]'.
220 ESMTP Sendmail 8.14.4/8.14.4/Debian-2ubuntu1; ...
250 Hello ...
250 2.1.0 <>... Sender ok
550 5.7.1 <>... 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: <> instead of RCPT TO: <>

Please see below the configuration that I currently use.

DNS Configuration:

Host                 Type  Priority  Redirect to MX    10 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/


Just for clarifications: and 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 (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 25
Trying A.B.C.D...
Connected to
Escape character is '^]'.
220 ESMTP Sendmail 8.14.4/8.14.4/Debian-2ubuntu1; ...
HELO remote-server
250 Hello ....
MAIL FROM: <...>
250 2.1.0 <...>... Sender ok
250 2.1.5 <>... Recipient ok

So it works for any subdomain except for the one that I'm interested into ( - 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 # Auto-generated hostname. Please do not remove this comment. A.B.C.D subdomain – Razvan Mar 16 '13 at 0:45

"Relaying denied"suggets that sendmail at does not treat 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 host?

YES=> What is reported by the command below exececuted by root at 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 and different host? You want handle email for and complain that 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. and point to the same IP. 2. I don't want to handle emails for - I would like for 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 – 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 fro DNS - MX 10 – 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 (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 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 it would have helped a lot ]

share|improve this answer
I put the complete on PasteBin: – 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.