Running multiple instances of sendmail on one server

<myvirtualip1> = 192.168.0.205
<myvirtualip1> = 192.168.0.206
<myvirtualdomain1> = webmx1.snapdedo.com
<myvirtualdomain2> = webmx2.snapdedo.com

cd /etc/mail
cp sendmail.mc sendmail.mc.`date +%Y%m%d%H%M`
service sendmail stop


cp sendmail.mc instance1sendmail.mc
cp sendmail.mc instance2sendmail.mc
vi instance1sendmail.mc
-- Replace Find the line with daemon options, something like this
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
change to bind to your virtual ip
DAEMON_OPTIONS(`Port=smtp,Addr=<myvirtualip1>, Name=MTA')dnl

-- Add
define('QUEUE_DIR','/var/spool/mqueue/instance1sendmail/q*')dnl
define('confPID_FILE','/var/run/instance1sendmail.pid')dnl
define('confDOMAIN_NAME','<myvirtualdomain1>')dnl

m4 /etc/mail/instance1sendmail.mc > /etc/mail/instance1sendmail.cf

mkdir /var/spool/mqueue/instance1sendmail
mkdir /var/spool/mqueue/instance1sendmail/q{1,2,3,4,5,6,7,8}
chown -R root:mail /var/spool/mqueue/
chmod -R 777 /var/spool/mqueue/

sendmail -L instance1sendmail -C /etc/mail/instance1sendmail.cf -bd –q30m

 

vi instance2sendmail.mc
-- Replace Find the line with daemon options, something like this
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
change to bind to your virtual ip
DAEMON_OPTIONS(`Port=smtp,Addr=<myvirtualip2>, Name=MTA')dnl

-- Add
define('QUEUE_DIR','/var/spool/mqueue/instance2sendmail/q*')dnl
define('confPID_FILE','/var/run/instance2sendmail.pid')dnl
define('confDOMAIN_NAME','<myvirtualdomain2>')dnl

m4 /etc/mail/instance2sendmail.mc > /etc/mail/instance2sendmail.cf

mkdir /var/spool/mqueue/instance2sendmail
mkdir /var/spool/mqueue/instance2sendmail/q{1,2,3,4,5,6,7,8}
chown -R root:mail /var/spool/mqueue/
chmod -R 777 /var/spool/mqueue/

sendmail -L instance2sendmail -C /etc/mail/instance2sendmail.cf -bd –q30m

netstat -an | grep :25

 

Test the email

[/app_scripts/Perl]$ telnet webmx1.snapdedo.com 25
Trying 192.168.0.205 ...
Connected to webmx1.snapdedo.com (192.168.0.205 ).
Escape character is '^]'.
220 webmx1.snapdedo.com ESMTP Sendmail 8.14.4/8.14.4; Wed, 29 Aug 2012 16:23:04 -0400
helo palmcoastd.com
250 webmx1.snapdedo.com Hello [192.168.0.208], pleased to meet you
mail from:scott.t.jenkins@snapdedo.com
250 2.1.0 scott.t.jenkins@snapdedo.com... Sender ok
rcpt to:scott.t.jenkins@snapdedo.com
550 5.7.1 scott.t.jenkins@snapdedo.com... Relaying denied. IP name lookup failed [192.168.0.208]

 

vi /etc/mail/access
-- Add
192.168                            RELAY

makemap hash /etc/mail/access < /etc/mail/access