Operating System - HP-UX
1752822 Members
4310 Online
108789 Solutions
New Discussion юеВ

Re: Sendmail without DNS lookup

 
SOLVED
Go to solution
G V R Shankar
Valued Contributor

Sendmail without DNS lookup

Hi,

We have a SMTP relay server. I have configured DS in sendmail.cf

When I am trying to send email, it is not able to resolve hp.com

# sendmail -v abcd@hp.com
This is a Test Email
.
hp.com: Name server timeout
abcd@hp.com... Transient parse error -- message queued for future delivery
abcd@hp.com... Queued

The DNS is not able to resolve hp.com

I have added an entry in /etc/hosts for hp.com and we are able to send emails properly.

My question is, can we send email to the relay server, without resolving hp.com

Ravi.
9 REPLIES 9
Sundar G
Frequent Advisor

Re: Sendmail without DNS lookup

Did you add the DM Entry and try?

DM

in your case

DM hp.com

Regards

Sundar
G V R Shankar
Valued Contributor

Re: Sendmail without DNS lookup

Yes, I have added DM entry also.

# who I masquerade as (null for no masquerading) (see also $=M)
DMhp.com

Still, it doesn't work.

Ravi.
VK2COT
Honored Contributor
Solution

Re: Sendmail without DNS lookup

Hello,

I can think of several possibilities.
Depending on which version of sendmail you
run, they will work.

a) Set /etc/nsswitch.conf to use "files"
for:

hosts: files
aliases: files

... and of course, your entry in /etc/mail/sendmail.cf for DS:

DS[myrelayhost.mydom.dom]

Putting square brackets around hostname
bypasses DNS query for smarthost.

Ensure that your smarthost is
listed in /etc/hosts too.

b) Create file /etc/mail/service.switch

hosts files

c) Change /etc/mail/sendmail.cf directly.
Look for the following lines and comment them out:

# pass to name server to make hostname canonical
R$* $| $* < @ $* > $* $: $2 < @ $[ $3 $] > $4

d) More complex way.

Change sendmail.mc file as per
http://www.sendmail.org/faq/section3#3.22

FEATURE(`accept_unresolvable_domains')dnl
FEATURE(`accept_unqualified_senders')dnl
FEATURE(nocanonify)define(`confSERVICE_SWITCH_FILE',`/etc/mail/service.switch')dnl
FEATURE(nocanonify)
define(`SMART_HOST',`myrelayhost.mydom.dom')

Edit the submit.mc file and add the
following line:

define(`confDIRECT_SUBMISSION_MODIFIERS', `C')dnl

Rebuild your sendmail.cf and submit.cf.

That should do it.

Cheers,

VK2COT
VK2COT - Dusan Baljevic
G V R Shankar
Valued Contributor

Re: Sendmail without DNS lookup

Hi,

I have already configured step a and b. It didn't help me, because my server is unable to resolve hp.com The relay server belongs to some other domain, it is not hp.com

# sendmail -v abcd@hp.com
This is a Test Email
.
hp.com: Name server timeout
abcd@hp.com... Transient parse error -- message queued for future delivery
abcd@hp.com... Queued

After trying step c, I have started getting emails, without having hp.com in /etc/hosts file.

I didn't try step D, as it is complex ;) I like things to be simple.

Could you please explain more about step c.

# pass to name server to make hostname canonical
R$* $| $* < @ $* > $* $: $2 < @ $[ $3 $] > $4

Cheers,
Ravi.
VK2COT
Honored Contributor

Re: Sendmail without DNS lookup

Hello,

Step c) - comment out these
two lines in /etc/mail/sendmail.cf
and restart sendmail. In other words,
these two lines will look like:

# pass to name server to make hostname canonical
# R$* $| $* < @ $* > $* $: $2 < @ $[ $3 $] > $4

To restart sendmail:

/sbin/init.d/sendmail stop
/sbin/init.d/sendmail start

These two lines try to resolve hostname
via DNS server, an dthat is what you want to
disable...

Cheers,

VK2COT
VK2COT - Dusan Baljevic
G V R Shankar
Valued Contributor

Re: Sendmail without DNS lookup

Hi,

Thank You for the reply.

I am bit confused about your statement.

"These two lines try to resolve hostname
via DNS server, an dthat is what you want to
disable..."

Are you speaking about local hostname or the hp.com which is present in the email address.

Cheers,
Ravi.
VK2COT
Honored Contributor

Re: Sendmail without DNS lookup

Hello Ravi,

These two lines simple try to use DNS
resolution for anything that is not defined
in /etc/hosts or other databases that
/etc/nsswitch.conf might be pointing to
(NIS, NIS+, LDAP...).

Cheers,

VK2COT
VK2COT - Dusan Baljevic
Steven E. Protter
Exalted Contributor

Re: Sendmail without DNS lookup

Shalom,

DS is the best option, but it requires the administrator of the smtp relay server to configure the server to accept mail from your specific host.

A better solution might be to do this:

dig mx hp.com

That will list the mail exchange servers on your domain, use your domain not hp.com unless you are at hp.

Set up this name resolution at /etc/hosts file and your mail may flow.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
G V R Shankar
Valued Contributor

Re: Sendmail without DNS lookup

Hi All,

Thank You Very Much for takling time to help me resolve the case and clarifying my doubts.

Thanks Again.

Cheers,
Ravi.