SENDMAIL Configurations

SMTP relay will also check the source of sender by using ping-back. Thus, the servername “” must have:
– A (HOST) record with updated IP Address, currently
– MX (Mail Exchange) record pointing to
Also, this line must also be updated as:
vim /etc/mail/authinfo
Edit this line ==> “U:xkdoan” “P:password” “M:SSL”
Notice: there is no <xkdoan> and no <password>

1. configure your smtp-server

(this requires that you have the package sendmail-cf installed)

1.1. changes to /etc/mail/

Uncomment the definition SMART_HOST and add the corresponding FEATURE to it:
define(`SMART_HOST’, `’)
Note: Please note, that these are “oriented” quotes.

1.2. create the new

Stop sendmail by issuing the command
/sbin/service sendmail stop
and log on as root to issue this command.
m4 /etc/mail/ > /etc/mail/

1.3. Define the account information for connecting to the smtp-server

Edit/create /etc/mail/authinfo and add the following line:
AuthInfo:<> “U:<>” “P:<password>” “M:SSL”
Note:The M: may vary depending on the capabilities of the smtp-server (e.g. CRAM-MD5, PLAIN).
Create authinfo.db:
makemap hash /etc/mail/authinfo < /etc/mail/authinfo
and finally restart sendmail:
/sbin/service sendmail restart

1.4. Configure header rewriting (optional)

Header rewriting consists in replacing the From: and Reply to: in the header of an outgoing mail in order for the recipient to reply to a valid address.
This can be set by editing the file /etc/mail/userdb:
<local-name>:mailname <email-adsress>
# /etc/mail/userdb
Finally create the corresponding database:
makemap btree /etc/mail/userdb.db < /etc/mail/userdb
… and finally restart sendmail:
/sbin/service sendmail restart

1.5. Test your settings

Issue following commands and check the trace for verifying the delivery path:
/usr/sbin/sendmail -bv root@localhost Should show a “local” delivery.
/usr/sbin/sendmail -bv Should show a delivery path through your ISP.
For troubleshooting you should check the mail-log: /var/log/maillog

2. Forwarding

Forward can be defined in ~/.forward. (just enter the e-mail addressto forward to). Note:The permissions of that file must be adjusted correspondingly in order to avoid sendmail ignoring it (see /var/log/maillog in case of problems).


Sendmail configuration is not for the faint of heart. Debugging and diagnosis can be even harder, at times. We provide the instructions below, but they gloss over some of the major configuration management issues inherent to Sendmail, and we cannot assist you with those issues. We strongly recommend Exim as an alternative UNIX SMTP server.
These instructions assume that you already have an appropriate .mc file prepared for your Sendmail configuration, and have the appropriate commands/tools prepared to compile that into a file and install it in the appropriate location. On some BSD-based systems, this is as simple as typing “make” in /etc/mail and editing $ On other systems, it can be considerably more difficult. Consult the manual for your system or Sendmail for more information.
  1. Add the following lines to your .mc file:
    FEATURE(authinfo, `hash -o /etc/mail/authinfo’)
    If you need to use an alternate port (other than 25) for MailHop Outbound, also add the following line:
    define(RELAY_MAILER_ARGS, `TCP $h 2525′)
    You may also use port 10025 or any other standard SMTP port that we offer for the MailHop Outbound service in the above line, in place of “2525”. You should NOT use the SMTPS port(s) we offer.
  2. Create or edit the file /etc/mail/authinfo, and add a line that looks like this: “U:username” “P:password” “M:LOGIN”
    Replacing “username” and “password” with your DynDNS username and password, respectively. Be sure to include the rest of the line exactly as it is shown above, quotes and all. You should make sure that this file is not readable by unpriviledged users, as it contains your login information.
  3. Build the authinfo file into the Sendmail hash database format with the following command:
    makemap hash /etc/mail/authinfo < /etc/mail/authinfo
    This will create an /etc/mail/authinfo.db file, which Sendmail will use to read the authentication information. You will need to re-run the above command any time you change /etc/mail/authinfo.
  4. Finally, compile your .mc file to a .cf file, install it as , and re-start Sendmail. Your server should now send all mail via the MailHop Outbound server!
May also use port 587
Read Root Emails:
cat /var/spool/mail/root
Remove mails from Root
rm /var/spool/mail/root


Sendmail’s configuration files are written in a macro language known as M4. This gives them a great deal of configurability (arguably more so than any other MTA), but makes them very complicated and hard to “get right”.
Once you have configured to your liking, you must compile it down to There are a number of ways to do this, and depending upon who you ask you may get wildly different answers, but I usually prefer the following:
First, I compile the file to a temporary file:
# m4 >
I do this to prevent accidentally breaking Sendmail’s functionality during the compile. After this, I simply move the temporary file onto the permanent one:
# mv
This is typically a pretty safe thing to do, and should not disrupt a running Sendmail system.
Posted on Categories Linux

Leave a Reply

Your email address will not be published. Required fields are marked *