I have pointed domain1.com and domain2.com to the same server on the same IP. Now email directed to me@domain2.com gets rejected:

X.X.X.X does not like recipient.
Remote host said: 550 5.7.1
... Relaying denied. Proper authentication required.
Giving up on X.X.X.X

How do I configure Sendmail to accept mail directed to domain2.com as it does with domain1.com and send it to domain1.com mailboxes?

I need to have domain2.com act as an alias of domain1.com.


The answer with sendmail is, as so often, it depends.

Sendmail's list of domains for which it regards itself as local is configured in sendmail.cf, which is usually found either in /etc or /etc/mail. If you grep it out, with eg

[madhatta@www mail]$ grep '^Fw' /etc/mail/sendmail.cf

you can see that, in my case, the list of "local" domains is /etc/mail/sendmail.cw, a file which contains one domain per line. You need to find which file is authoritative for your sendmail, and add domain2.com to the list in that file.

  • 1
    More appropriate suggestion would have been "Read sendmail.mc, grok it, use FEATURE(use_cw_file) and edit cw-file" – Lazy Badger Nov 1 '11 at 10:47
  • Probably, but for the OP to have actually made use of that, I'd've had to write an entire primer on configuring sendmail via m4, and without knowing his distro, I'd've had to include paths for about eight different possible locations for the current mc file. He may not even have it - RH-based distros can happily install the sendmail package without bringing sendmail-cf along with it. – MadHatter Nov 1 '11 at 11:02
  • You could drop only one URL for configuring sendmail. RTFM will be must anyway – Lazy Badger Nov 1 '11 at 11:47
  • You're probably right, but see "Providing context for links" in serverfault.com/questions/how-to-answer ; local policy frowns on just giving a link to information, and as I said, I couldn't face opening the m4-can-of-worms. You're dead right that the OP needs to RTFM for sendmail, too, but if she doesn't already know that, nothing I say will change it. Instead, I've given her an answer that will get the immediate job done. Hopefully she'll then follow your excellent advice, too, and learn to properly grok sendmail before using it in production. – MadHatter Nov 1 '11 at 12:18

I have pointed domain1.com and domain2.com to the same server on the same IP

With MX records only?

Now email directed to me@domain2.com gets rejected

Because domain2.com isn't localdomain for Sendmail

  • Yes, with MX records. Can I make domain2.com local for Sendmail? – Ra. Nov 1 '11 at 11:47
  • yes, you can. Read MadHatter's fast explanation – Lazy Badger Nov 1 '11 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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