0

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.

1 Answer 1

2

"Host name lookup failure" indicates a DNS error, not necessarily a sendmail misconfiguration.

Sendmail, or rather sending email heavily depends on DNS and does not play well with hosts and domains that only exist as entries in the /etc/hosts file.

The simplest would be to ensure that nslookup bres.net.com works.

Maybe it's the formatting of your question, but the entry bres.net.com 192.65.7.8 does not belong in a resolv.conf and there should be an entry nameserver <IP-address of nameserver> in there as well. A simple resolv.conf looks like:

#/etc/resolv.conf domain example.com search example.com nameserver 8.8.8.8 options attempts:2 

You might try and use the IP-address of the smarthost rather than a hostname as well to avoid some DNS issues:

define(`SMART_HOST',`[192.65.7.8]')dnl 
4
  • Actually, i can ping bres.net.com. Can you please explain more bres.net.com 192.65.7.8 does not belong in a resolv.conf and there should be an entry nameserver <IP-address of nameserver> in there as well.?thanks Commented Nov 22, 2016 at 5:46
  • hi, i ve already changed by using ip address but the log show different from before. Updated at the question. Commented Nov 23, 2016 at 2:23
  • An sendmail log entry stat=Sent (<id> Message accepted for delivery) typically indicates succes. Are messages delivered or still sitting in the queue (check as root with mailq) Commented Nov 23, 2016 at 10:05
  • yesterday, it work perfectly fine.changes update at question. but today, after restart the server, the log show connection refused from localhost and cannot send email. Commented Nov 25, 2016 at 2:18

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.