Tuesday, February 16, 2010

Sendmail Relaying : Understanding what's the Relaying all about?

My Overall architectural setup resembles as shown below:

langille.org [NEW DOMAIN] <=== freebsddiary[MAIL SERVER] <== INTERNET <== fred.logic.com[ ANY FOREIGN CLIENT]

I use langille.org as an example domain.
Just registered this domain few days back.
My Mail server is freebsddiary.

As of now my sendmail doesnt know about that domain.
I will have to tell the server about this new domain.

My Mail server doesn't accept incoming mail for that domain(langile.org).However may mail is registered as the mail host for that domain.

Type the following command :

host langille.org

langille.org mail is handled (pri=5) by freebsddiary.yi.org

If someone tried to send mail to langille.org, it will arrive at freebsddiary.org(my mail server) but it will be refused.

Logs will report:

Oct 30 11:04:44 ducky sendmail[98224]: LAA98224: ruleset=check_rcpt,
arg1=, relay=mta1-rme.xtra.co.nz [], reject=550
... Relaying denied
Oct 30 11:04:44 ducky sendmail[98224]: LAA98224: from=, SIZE=938,
class=0, pri=0, nrcpts=0, proto=ESMTP,
relay=mta1-rme.xtra.co.nz []

Note that above example represents mail being sent to langille.org from an external domain. It is incoming mail.

To allow sendmail to receive mail for langille.org, I added the following entry to

/etc/mail/sendmail.cw (after sendmail version 8.10, this file is local-host-names).


Then I told sendmail to re-read it's configuration files by issuing the following commands.

# killall -hup sendmail


Your friend's domain is retch.org. You wish to allow your friend to use your mail server. The box he will be sending mail from is dry.retch.org.

You would add the following entries to the files on your mail server:

File: /etc/mail/relay-domains


The above tells your mail server to accept outgoing mail from the host dry.retch.org.

File: /etc/mail/sendmail.cw


The above tells your mail server to accept incoming mail for the domain retch.org (after sendmail version 8.10, this file is local-host-names).

Final Conclusion:

/etc/mail/relay-domains contains a list of hosts which are allowed to relay mail through your mail server. This list may consist of either specific hosts or whole domains.

/etc/mail/sendmail.cw (after sendmail version 8.10, this file is local-host-names) contains a list of domains for which your mail server will accept mail. This list is usually the domains hosted by your machine.

1 comment:

  1. One more thing I want to add up:
    For Sendmail Client to know where is destined sendmail server Use SMART_HOST under Feature directive under sendmail.mc