Even more hints about sendmail/e-mail

Last Update 2002-01-22

Content:

How to queue mail for another domain?

Situation: Your system mailserver.my.domain should act as a backup mailserver for mailserver.client.domain. The client wants to receive mail for the address user@client.domain. This requires:
  1. MX Records:
    client.domain.		IN MX 10 mailserver.client.domain.
    client.domain.		IN MX 20 mailserver.my.domain.
    mailserver.client.domain.		IN MX 10 mailserver.client.domain.
    mailserver.client.domain.		IN MX 20 mailserver.my.domain.
    
    The last two records are there "just in case" (someone forgot masquerading).
    Make sure you use the real names of all systems. mailserver.my.domain must know its own name, otherwise you'll get the famous mail loops back to myself error.

    Instead of using MX records that point to mailserver.client.domain, you can use the FEATURE(mailertable) on mailserver.my.domain as explained in cf/README for routing e-mails.

  2. On your system: do nothing unless you have anti-relay rules installed (which you really should have!). In this case, add client.domain to the required files (8.8) (or for 8.9). Don't add client.domain or mailserver.client.domain to class w on your system!
  3. sendmail on your system will try to deliver mail during queue runs, however, the client may trigger delivery by using the ETRN command.

How to queue mail for a domain that is seldom online?

Situation: Your system mailserver.my.domain should act as a mailserver for mailserver.client.domain which is usually offline but has a fixed IP address. The client wants to receive mail for the address user@client.domain. This requires:
  1. MX Records:
    client.domain.		IN MX 20 mailserver.my.domain.
    mailserver.client.domain.		IN MX 20 mailserver.my.domain.
    
    The last record is there "just in case" (someone forgot masquerading).
    Make sure you use the real names of all systems.

    Setup FEATURE(mailertable) on mailserver.my.domain as explained in cf/README for routing e-mails:

    client.domain		esmtp:[mailserver.client.domain]
    .client.domain		esmtp:[mailserver.client.domain]
    
  2. On your system: add client.domain and mailserver.client.domain to the required files (8.8) (or for 8.9). Don't add client.domain or mailserver.client.domain to class w on your system!
  3. sendmail on your system will try to deliver mail during queue runs, however, the client may trigger delivery by using the ETRN command.

How do I add a footer/signature to all (outgoing) e-mails?

This is quite complicated. At first sight it might be simple: just "cat" some text (taken from a file or whatever) to the end of an e-mail passing through sendmail. However, there is a big problem: what is about structured e-mails, i.e. MIME e-mails? These can be arbitrarily complex and just "cat"ting a footer to the end of the body will break the MIME structure. Hence, there is no easy solution to this problem!

If you know enough about MIME and some C programming, then take a look at sendmail 8.11 and the libmilter/README. It now offers the functionality to achieve this goal. However, it is unsupported by me and sendmail.org! Please don't ask us questions about libmilter (however, we will fix bugs!)

How to reconstruct a .mc file from a .cf file?

In general: you can't do it automatically. But here are some hints: First: get a list of features, mailers, etc that have been used during the generation.
fgrep '@(#)' sendmail.cf
or (newer versions)
fgrep '$Id:' sendmail.cf
Then use the basic guidelines from cf/README to build a .mc file with those options. Create a .cf file from that .mc file and compare it with your current version. Find out what's different and try to include it in your .mc file. Follow the instructions in cf/README. Beware: if you use a different sendmail version to create the .cf file, there might be a lot of differences! So make sure you use the same version. After you have created the correct .mc file, you can use it with your current sendmail version to create the new .cf file.

config error: mail loops back to myself

You are still getting this message:
	553 relay.domain.net config error: mail loops back to myself
	554 <user@domain.net>... Local configuration error
and both hints didn't solve your problem?

So here is another hint what might be wrong: You use a

LOCAL_RULE_0
in your sendmail.mc (which is S98 in sendmail.cf)? This rule is evaluated before the local recognition of S0 happens. So if you use some rule here, which (by accident) also matches your local host but doesn't resolve to local, you have a problem. Try to debug that address and see where it fails (where it gets resolved to another mailer than local).
[(links)] [Hints] [Avoiding UBE] [cf/README] [New]
Copyright © Claus Aßmann Please send comments to: <ca at sendmail.org>
Disclaimer: the information provided may be inaccurate or outdated or incomplete. Please contact me if you find an error.