Configuring second mail relay

Hi all,

Once I already asked about this problem, but didn't get solution, so I am opening new thread.
Hope to get help from you guys.

So, my problem is:
I have Solaris 10 based server.
I have a script which should send mails using mailx (can use another if needed).

What I need is - mails which belongs to @AAA.com send to IP1 and mails which belongs to @BBB.com send to IP2 (I need to use different relays).

At the moment, script checking domain name to which mail belongs and changing file /etc/mail/sendmail.cf Smart Relay host each time each time, but this is workaround solution which is not good actually.

I tried to specify domains in /etc/mail/relay-domain in below format:

#more /etc/mail/relay-domain
AAA.com
BBB.com

but no success.

Can you guy help me please? :slight_smile:

That's covered by sendmail's mailertable feature, read here: cf/README - Using Mailertables

Thanks for the answer.
I've tried it before, but not sure that correctly defined parameters.

Here is what I have:

-bash-3.00# cat /etc/mail/mailertable
AAA.az relay:mailboxes.AAA.az
BBB.az relay:mailboxes.BBB.az
-bash-3.00#

Here my hosts file:

-bash-3.00# cat /etc/hosts
#
# Internet host table
#
::1 localhost
127.0.0.1 localhost
10.15.208.88 analizator analizator.com loghost
10.15.208.89 Analizator2
2.2.2.2 BBB.com mailhost
1.1.1.1 AAA.com
-bash-3.00#

Is it correct syntax?
Do I need to add FEATURE (`mailertable') in sendmail.cf?

You can put

FEATURE (`mailertable')

in /etc/mail/cf/cf/sendmail.mc , then run make and copy the resulting sendmail.cf to /etc/mail. Or you just put

Kmailertable hash -o /etc/mail/mailertable.db

directly into sendmail.cf

The mailertable file should look like this

AAA.az smtp:mailboxes.AAA.az
BBB.az smtp:mailboxes.BBB.az

Dont forget to execute

makemap hash mailertable </etc/mail/mailertable

after changes to the mailertable file.