Operating System - HP-UX
1752518 Members
5004 Online
108788 Solutions
New Discussion юеВ

How does mailx determine where to deliver mail to?

 
Dave Johnson_1
Super Advisor

How does mailx determine where to deliver mail to?

My HP-UX systems are able to send mail directly to our internal Exchange mail system however, we do not have an internal MX record on our DNS nor does the DNS server serve up the external MX record.
How is it possible for my server to send email when ping and nslookup for mx.domain.com does not return a result?
12 REPLIES 12
Steven E. Protter
Exalted Contributor

Re: How does mailx determine where to deliver mail to?

Shalom,

mailx does not dtermine mail delivery.

mailx passes its mail to the MTA, The Mail Transfer Agent.

That is by default sendmail.

The log is /var/adm/syslog/mail.log

nslookup mx.domain.com

If that fails and thats where your mail is supposed to go then you have part of your answer.

You can get around this quickly as follows:

Modify sendmail.cf

DS
[IP address of mail exchanger]

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

This takes DNS out of the mix.

If BIND is installed.

dig mx domain.com

Should return the mail exchanger.

Try ping by IP address.

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
Rita C Workman
Honored Contributor

Re: How does mailx determine where to deliver mail to?

If I'm reading this right,
You can send mail directly to your internal Exchange mail. I'm taking this that you relay mail to your Exchange mail server, so at that point mail should be going out via the Exchange server.

Your second statement that you can not ping or nslookup the mx.domain.com because your DNS doesn't have that entry. The issue here is resolution....
You could put the entry in your hostfile.
I'm going to guess that Windows (Exchange server) has some kind of DNS running....so why not set up your HPUX boxes so they know the DNS servers & will look at them.

Edit /etc/resolv.conf to include:
nameserver

Edit /etc/nsswitch.conf
hosts: files [NOTFOUND=continue] dns

Now it will check your hostfile first, then if not there it will check 'dns' and point to the IP of the DNS server you put in /etc/resolv.conf.

Just a thought,
Rita
Dave Johnson_1
Super Advisor

Re: How does mailx determine where to deliver mail to?

First let me make it clear that HP-UX is able to send email to any destination I care to send mail to. What I am trying to figure out is why it works to my internal Windows Exchange server for internal receipents. They only change made to sendmail.cf is to include my HP-UX box host name and to change the "CE root" statement to just CE. I use NIS. My nsswitch.conf file contains the line "hosts: files [NOTFOUND=continue UNAVAIL=continue] nis [NOTFOUND=continue UNAVAIL=continue] dns" and my resolv.conf contains"
search domain.com
nameserver
nameserver

ping mx.domain.com
returns "ping: unknown host mx.domain.com"

nslookup mx.domain.com
returns "p-dns.domain.com can't find mx.domain.com: Non-existent domain"

Yet if I do "mailx my.name@domain.com" the mail is delivered to my Outlook mailbox after a few seconds. Why does this work?
TTr
Honored Contributor

Re: How does mailx determine where to deliver mail to?

> First let me make it clear that HP-UX is able to send email to any destination I care to send mail to

It is not the HP-UX server that is doing the sending. The HP-UX server most likely relays the mail to another server, probably your exchange server. You can verify it by checking in two places.
1. Look in your /etc/mail/sendmail.cf file and look for a line that starts with DS it is the relay server that HP-UX is using to deliver the mail
2. Look in the /var/adm/syslog/mail.log file and find a log entry for a message that was sent outside your domain. Its "to=" should have an outside email address and its "relay=" should have the server that your HP-UX server relays to.
Dave Johnson_1
Super Advisor

Re: How does mailx determine where to deliver mail to?

If the HP-UX server is not sending the email, how does it get out of the server? Of course it is sending the email. And it is not using any sort of relay, the DS line is otherwise blank. Sendmail is determining an address to send the mail directly to my Exchange server, but I cannot see where it is determining this information from.
When I scan the log file for today's date and the word relay and my domain, I find email sent to addresses on my Exchange server do say relay=.domain.com. So how does it find out the name of the Exchange relay server?
Steven E. Protter
Exalted Contributor

Re: How does mailx determine where to deliver mail to?

Shalom,

You definitely have a DNS problem.

Lookups are not working.

However as my original post points out you don't need DNS to get mail off the server.

If you have:

DS
[ip address]

In sendmail.cf your mail will get off the server.

Solving the DNS problem is a good idea for normal server operation.

/etc/nsswitch.conf
Make sure it makes sense, as per Rita's post.

/etc/resolv.conf
Make sure you can ping these hosts and there are no configuration errors.

use nslookup,host,dig if available to test your changes.

Perhaps copy /etc/nsswitch.conf and /etc/resolv.conf from another working HP-UX server. That always works for me.

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
Patrick Wallek
Honored Contributor

Re: How does mailx determine where to deliver mail to?

Check the file: /etc/rc.config.d/mailservs

Specifically see if there is a name or IP address on the SENDMAIL_SERVER_NAME line. If so, that is where your mail will be sent.
Dave Johnson_1
Super Advisor

Re: How does mailx determine where to deliver mail to?

SEP,
I do not have a DNS problem. DNS is working fine. I am able to send mail. The DS line is blank, there is no IP address entered in the config file.
What I need to find out is WHY sending mail is wokring when everything I read tells me it will not work if there is no MX record in DNS and the DS line is blank?
TTr
Honored Contributor

Re: How does mailx determine where to deliver mail to?

> And it is not using any sort of relay, the DS line is otherwise blank
> email sent to addresses on my Exchange server do say relay=.domain.com

The above two statements contradict each other.
If you are positive there is no DS entry in the /etc/mail/sendmail.cf file, then do you have any other user translation defined in /etc/mail? Look in the aliases files and also for existence of maps such as mailertable, domaintable, genericstable and virtusertable, relay-domains.

One last longshot thought. Is the sendmail daemon not using the default config file /etc/mail/sendmail.cf?