Operating System - HP-UX
1827452 Members
3981 Online
109965 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?
Dave Johnson_1
Super Advisor

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

Alias file it the default shipped with 11.23. The /etc/rc.config.d/mailservers file is the default shipped with 11.23:
export SENDMAIL_SERVER=1
export SENDMAIL_SERVER_NAME=
Here is the DS line as it appears in the sendmail.cf file:
# "Smart" relay host (may be null)
DS

# LUSER-RELAY

This server (and all the other HP-UX boxes here) have sendmail config files that are unaltered from the original install except for the CE line was changed from "CE root" to just CE and the DM line was changed from DM to "DMmx1.domain.com".

Please understand these are servers built and installed by HP for me and I am the only one here with the root password. (Before anyone tried to chastise this, it is in a sealed envelope in a secure location, so if I am hit by a bus, my boss can give it to someone as needed.) Once connected to our network, I gave them IP addresses, host names and pointed them to the company Windows DNS servers.

Again email works, I just do not understand why if there is no MX record on the inside DNS server.
Steven E. Protter
Exalted Contributor

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

Shalom again.

Alias file it the default shipped with 11.23. The /etc/rc.config.d/mailservers file is the default shipped with 11.23:
export SENDMAIL_SERVER=1
export SENDMAIL_SERVER_NAME=
Here is the DS line as it appears in the sendmail.cf file:
# "Smart" relay host (may be null)
DS

# LUSER-RELAY

This server (and all the other HP-UX boxes here) have sendmail config files that are unaltered from the original install except for the CE line was changed from "CE root" to just CE and the DM line was changed from DM to "DMmx1.domain.com".

Please understand these are servers built and installed by HP for me and I am the only one here with the root password. (Before anyone tried to chastise this, it is in a sealed envelope in a secure location, so if I am hit by a bus, my boss can give it to someone as needed.)
>>
Quite the opposite. I find your security arrangement ideal.
<<
Once connected to our network, I gave them IP addresses, host names and pointed them to the company Windows DNS servers.

Again email works, I just do not understand why if there is no MX record on the inside DNS server.

If nslookup does not work, and your server can't find its mail exchanger, I am quite curious as to how mail is getting off your server.

Take a look at /var/adm/syslog/mail.log, that might give you a clue.

By default, sendmail tries to resolve the domain name, obtain the mail exchanger and will send the mail to the proper domain.

DNS need not work if there is an /etc/hosts entry to provide the system an answer as far as the mail exchanger goes.

It is quite interesting that your system is getting mail off if ping and nslookup is not working.

Take a look at sendmail.cf itself. It is possible there is a bypass statement put there by accident when HP set up the system. It would look like what I was recommending to resolve the problem.

I still say copying /etc/nsswitch.conf and /etc/resolv.conf from a fully working system that can ping/nslookup the mail exchanger would resolve the more important problem which is the system can't look up the mail exchanger.

It is possible an m4 was run on sendmail.mc which generated a sendmail.cf file that gets the mail going.

I think the key file to look at is sendmail.cf

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
Dave Johnson_1
Super Advisor

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

Upon closer inspection the DNS does have an MX record for our domain. It was not where he was expecting to find it.
Thanks for the input,
-Dave