Configure sendmail on DCA servers to send out emails via your SMTP server

Note: Configuring access to an external SMTP Forwarder

It is possible to configure sendmail on the DCA servers to listen on the loopback interface and send out emails via your SMTP server.

For example, you have written daily maintenance scripts that runs every day in cron and reports the list of tables vacuum and analyzed, no of active queries and their current runtimes in last 24 hours. This script will run on the active master node (mdw or smdw) and log the information. If you want the log sent to your Database Administrator (DBA) twice per day, you must make the master nodes aware of the SMTP server. 

You then run a command, probably in cron, per day to send the log.

Note: Ensure that the server being configured has network access to an external SMTP server.

1. On the DCA server, sign in as root.

2. Verify that sendmail-cf is installed:

[root@sachi mail]# rpm -qa | grep sendmail-cf

sendmail-cf-8.14.4-8.el6.noarch

[root@sachi mail]# 

3. Open the sendmail configuration file:

[root@sachi mail]# cd /etc/mail

root@hostname# vi sendmail.mc

[root@sachi mail]# ls -l sendmail.mc 

-rw-r--r--. 1 root root 7744 Oct 29 10:19 sendmail.mc

4. In the configuration file, find the following line:

dnl define(‘SMART_HOST’, ‘smtp.your.provider’)dnl

5. Uncomment the line by removing dnl and change the line to point at your SMTP server:

define(‘SMART_HOST’, ‘smtp.foobar.com’)dnl

6. Add the following line to map the current hostname to its external interface:

define(‘confDOMAIN_NAME’, ‘somename.foobar.com.’)dnl

7. Rebuild sendmail.cf:

root@sachi# make

8. Run dca_setup to add an entry to /etc/hosts so sendmail can map to the hostname in confDOMAIN_NAME:

a. Start dca_setup:

# dca_setup

b. Select Option 2 - Modify DCA Settings.

c. Select Option 14 - Modify Hostnames.

d. Select Option 4 - Add a Non DCA Hostname.

e. Enter the name and IP address of the SMTP server when prompted:

<The Non DCA Hostname>

<The Non DCA IP>

f. Press Enter.

9. Turn on sendmail and start the service:

root@hostname# chkconfig sendmail on

root@hostname# service sendmail start