Sendmail Notes

Sendmail's configuration is handled by the file Depending on which Linux distro you are running, it may be in /etc/ or /etc/mail/ (probably the latter).

In most installations, the file is automatically created from a set of "" files.

This document describes both methods of fixing the problem. If you are using ".mc" files, you should use that method.

If you don't configure the machine via the ".mc" file:

First, make a backup of your existing .cf file, for reference/recovery.

Sendmail gets its identity from the "j" macro. Look for the line in the .cf file that says something like:

# my official domain name
# ... define this only if sendmail cannot automatically determine your domain

The "Dj" bit is what you're looking for. You'll "D"efine the value of the "j" macro, which is the string used in the HELO when your server connects to somewhere else. You'll need to remove the leading comment '#'. Example:

If you've done some googling about this problem, you may have seen comments with respect to "causing a loop in sendmail"; but it may be in reference to another config file sendmail uses to determine the host and domain names it answers to (which is to say, domains it is willing to deliver mail for), which may be called either "local-host-names" or "", and is defined in the .cf file thus:

# file containing names of hosts for which we receive email


# file containing names of hosts for which we receive email

Obviously, you need to tell sendmail what domains it is to receive mail for; setting Dj to your host/domain name shouldn't cause a loop, though, even if the domain name is in the file.

If you use the .mc file to configure your sendmail:

To configure this stuff in your .mc file (often found in /etc/mail/cf/cf or /path/to/your/sendmail/src/cf/cf, which should probably be linked to /etc/mail/cf/cf anyway) use:

define(`confCW_FILE', `/etc/mail/local-host-names')dnl
define(`confDOMAIN_NAME', `')dnl

(making the appropriate substitutions, obviously, for the name of the file and the host/domain name). Mind the quotes (') and backticks (`) - they're that way for a reason.

Once you've added the appropriate names to the mc file, you can generate a new .cf according to the instructions that came with your distribution of Linux (usually just "m4 < >" followed by testing the .cf in sendmail, a la "sendmail -bt -C ./" and copying the new .cf to /etc/mail or wherever your distro puts it by default).

If you're making changes to the .cf file directly, that's all you have to do - you're ready to restart.

Then restart the sendmail process, either by 1) sending a "hangup" signal to the running process, or 2) by shutting it down and starting up again from init.d.

1) ps ax | grep sendmail

look for the line that shows sendmail's master process id:

25824 ?        S      0:04 sendmail: accepting connections

You want the first number (e.g., 25824). Now, as root, or using sudo, send it a "HUP" and watch the mail log:

kill -HUP 25824 ; tail -f /var/log/maillog

to make sure the process actually survives ;) if you see SYSERR lines, you may need to do further debugging.

2) the init.d method (may vary from distro to distro):

As root, or using sudo, run:

/etc/init.d/sendmail stop
/etc/init.d/sendmail start

Then tail the maillog file as above and check for SYSERR lines. If it all went well, you shouldn't see any. If you do see SYSERR lines, restore your old .cf and stop and start the server. so you can figure out what went wrong.

To check the HELO is being sent as you intend, send yourself mail at another account. For example, if you send to gmail, you'll see a line in the full mail headers like this:

Received: from HELO ( [])
	by with ESMTP id g9si3025989wra.2005.;
	Fri, 02 Sep 2005 07:49:17 -0700 (PDT)

You SHOULD see the string you added after the "Dj" macro in the space above that says "HELO". If not, let us know and we'll walk you through figuring out why you didn't.