Relaying Mail from Subdomains

Many releases ago (starting with sendmail 8.9), sendmail defaults changed so that email would no longer be

relayed unless the application was specifically built or configured to allow this behavior. Too many spammers were taking advantage of the friendly posture of our mail servers to help them with their nasty business. If, on the other hand, you are sending mail to or from the local domain, no problem.

Relaying for sendmail is defined as mail coming from outside the domain being sent to outside the domain. For example, trying to send mail from a.com to c.com would involve a relay if asked of b.com and won't be supported by b.com if relaying is denied.

The behavior on modern sendmail servers to refuse to relay mail can bite you, however, if what you want is to be able to send mail from a subdomain to systems on your parent domain. In this case, allowing mail to be fowarded can be altered with your sendmail settings.

If the relay_entire_domains feature is supported (which it generally is), all you have to do is add your subdomains to a file named /etc/mail/relay-domains and then restart sendmail. If a sendmail service on subatomic.particles.org needs to relay mail to or from hosts on the particles.org, add the parent domain to its relay-domains file.

# domainname
subatomic.particles.org
# cat /etc/mail/relay-domains
particles.org
# /etc/rc2.d/S88sendmail restart

If a finer-grained relay mechanism is needed, you can use the relay_hosts_only feature and allow relaying only to particular systems

# domainname
subatomic.particles.org
# cat /etc/mail/relay-domains
boson.particles.org
fermion.particles.org
# /etc/rc2.d/S88sendmail restart

You can also relay domains using the access_db feature, though a little more work is involved. You have to set up your access database, add records to it and run the makemap command to build the file sendmail will read. Then you still have to restart sendmail or send it an HUP signal so tha it will take note of the changes.

From CIO: 8 Free Online Courses to Grow Your Tech Skills
Join the discussion
Be the first to comment on this article. Our Commenting Policies