i have a red hat linux server which cannot send outgoing emails. i also have a solaris server which already cofigured before to relay mails to the mail server. to enable user receive email from red hat, i need to relay mail through the solaris server. And my boss strictly asked me to using sendmail instead postfix.
so far, this is what i do:
solaris server : bres.net.com - 192.65.7.8
red hat: hostname : batman ip : 192.55.7.43
Edit /etc/mail/sendmail.mc
define(`SMART_HOST',`bres.net.com')dnl MASQUERADE_AS(`net.com')dnl FEATURE(masquerade_envelope)dnl FEATURE(masquerade_entire_domain)dnl MASQUERADE_DOMAIN(localhost)dnl MASQUERADE_DOMAIN(localhost.net.com)dnl MASQUERADE_DOMAIN(batman.net.com)dnl MASQUERADE_DOMAIN(others.net.com)dnl Edit /etc/hosts
127.0.0.1 batman.net.com localhost.localdomain localhost batman 192.55.7.43 batman batman.net.com loghost 192.65.7.8 bres bres.net.com Edit /etc/resolv.conf
search net.com bres.net.com 192.65.7.8 Create new sendmail.cf :
m4 sendmail.mc > sendmail.cf Restart sendmail
Test it by try sending mail
Check log /var/log/maillog
Nov 22 12:00:54 localhost sendmail[22251]: uAM402ru022251: from=root, size=591, class=0, nrcpts=1, msgid=<[email protected]>, relay=root@localhost Nov 22 12:02:54 localhost sendmail[22281]: uAM40sRm022281: from=<[email protected] >, size=863, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MTA, relay=batman.net.com[127.0.0.1] Nov 22 12:02:54 localhost sendmail[22251]: uAM402ru022251: to=root, ctladdr=root (0/0), delay=00:02:52, xdelay=00:02:00, mailer=relay, pri=30591, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (uAM40sRm022281 Message accepted for delivery) Nov 22 12:04:14 localhost sendmail[22303]: uAM40sRm022281: to=<[email protected]>, delay=00:01:20, xdelay=00:01:20, mailer=relay, pri=120863, relay=bres.net.com, dsn=4.0.0, stat=Deferred: Name server: bres.net.com: host name lookup failure After change define(SMART_HOST',192.65.7.8')dnl =, the log show as below:
Nov 23 09:51:49 batman sendmail[8953]: uAN1m5aZ008953: from=<[email protected]>, size=1052, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MTA, relay=batman.net.com [127.0.0.1] Nov 23 09:51:49 batman sm-msp-queue[8950]: uAMM02K3007934: to=root, ctladdr=root (0/0), delay=03:51:47, xdelay=00:03:44, mailer=relay, pri=120780, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (uAN1m5aZ008953 Message accepted for delivery) Nov 23 09:51:49 batman sendmail[8964]: uAN1m5aZ008953: to=<[email protected]>, ctladdr=<[email protected]> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31276, dsn=2.0.0, stat=Sent Nov 23 09:51:49 batman sendmail[8953]: uAN1m5ab008953: from=<[email protected]>, size=3002, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MTA, relay=batman.net.com [127.0.0.1] Nov 23 09:51:49 batman sm-msp-queue[8950]: uAMK2UOH007318: to=root, ctladdr=root (0/0), delay=05:49:19, xdelay=00:00:00, mailer=relay, pri=122704, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (uAN1m5ab008953 Message accepted for delivery) Nov 23 09:51:49 batman sendmail[8966]: uAN1m5ab008953: to=<[email protected]>, ctladdr=<[email protected]> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=33231, dsn=2.0.0, stat=Sent Nov 23 09:54:11 batman sendmail[8962]: uAN1oRWw008962: from=root, size=66, class=0, nrcpts=1, msgid=<[email protected]>, relay=root@localhost Nov 23 09:54:11 batman sendmail[8962]: uAN1oRWw008962: [email protected], delay=00:03:44, mailer=esmtp, pri=30066, dsn=4.4.3, stat=queued I can relay email by changed the define SMARTHOST and add one config file(service.switch) at etc/mail.
define(`SMART_HOST',`relay:[192.65.7.8]')dnl add service.switch at etc/mail
####### start of file ######### hosts files aliases files ####### end of file ########### After changes, the mail relay working perfectly fine. But after red hat server restart, the sendmail not working and the logs shows as below:
Nov 25 10:00:30 batman sendmail[15372]: uAP20Ude015372: from=root, size=66,class=0, nrcpts=1, msgid=<[email protected]>, relay=root@localhost Nov 25 10:00:30 batman sendmail[15372]: uAP20Ude015372: [email protected], ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30066,relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1] and before this log, the log show:
Nov 24 10:09:47 batman sendmail[24936]: uAO29kOL024936: ruleset=check_rcpt, arg1=<[email protected]>, relay=[192.65.7.8], reject=450 4.4.0 <[email protected]>... Relaying temporarily denied. Cannot resolve PTR record for 192.65.7.8 The log show connection refused and Cannot resolve PTR record. Please help.