12/23/2014

How to make send only sendmail server.

I have a EC2 instance in AWS. I configured my sendmail to send only for some purpose. Here is how. Let's say the your servers are in the subnet of 10.0.1.0/24 and the IP address of the relay server is 10.0.1.25.

1. Allow relay from your VPC in /etc/mail/access

--access--
[root@host /]# cd /etc/mail
[root@host /]# cp access access.org
[root@host /]# cp access.db access.db.org
[root@host /]# vi access
===
Connect:localhost.localdomain           RELAY
Connect:localhost                       RELAY
Connect:127.0.0.1                       RELAY
Connect:10.0                            RELAY  <-- Add
===
[root@host /]# makemap -v hash access.db < access

--submit.mc--
[root@host /]# cp submit.mc submit.mc.org
[root@host /]# cp submit.cf submit.cf.org
[root@host /]# vi submit.mc
===
define(`confDOMAIN_NAME', `yourdomain.com')dnl  <-- Add
FEATURE(`msp', `[10.0.1.25]')dnl  <-- Change to your relay server.
===
[root@host /]# m4 submit.mc > submit.cf

--sendmail.mc--
[root@host /]# cp sendmail.mc sendmail.mc.org
[root@host /]# cp sendmail.cf sendmail.cf.org
[root@host /]# vi sendmail.mc
===
define(`SMART_HOST', `[10.0.1.25]')dnl  <-- Add
define(`MAIL_HUB', `yourdomain.com.')dnl  <-- Add
define(`LOCAL_RELAY', `yourdomain.com.')dnl  <-- Add
===
[root@host /]# make sendmail.cf
[root@host /]# service sendmail restart

That's it!
Then test it from your web server.





No comments: