Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
General
cancel
Showing results for 
Search instead for 
Did you mean: 

how does mailx look up the mail server

ran_li
Regular Advisor

how does mailx look up the mail server

Hello pros,

Two questions,

1. how does mailx lookup the mail server? what is the steps?

2. I want to send mail using assigned mail server, how to accomplish that?

Thanks in advance!
16 REPLIES
NMory
Respected Contributor

Re: how does mailx look up the mail server

ran:

You can check the man pages for mailx, dtmail, mail and sendmail. You will be able to grab some information from there.

Luis
ran_li
Regular Advisor

Re: how does mailx look up the mail server

I don't think man page tell you that, plus I tried to set DS in sendmail.cf and it does not work, as expected so I don't know what I did wrong. Thanks.
James R. Ferguson
Acclaimed Contributor

Re: how does mailx look up the mail server

Hi:

'sendmail' relys on having a viable DNS running, so first, do that.

You need to setup the smart relay macro in '/etc/mail/sendmail.cf'. You should have something like:

DSadmin.exchange.com

...for the DS macro which should be commented-out.

Also, add your server's hostname and FQDN to '/etc/mail/sendmail.cw' if its not already there.

You do *not* need to have the 'sendmail' daemon running to send out-going mails. Thus, if you wish, set SENDMAIL_SERVER=0 in ' /etc/rc.config.d/mailservs'.

Regards!

...JRF...

NMory
Respected Contributor

Re: how does mailx look up the mail server

Are you having some sort error messages in your config?, or when you are trying to send mail?

Just in case check this link also:
http://docs.hp.com/en/5991-4829/index.html

LN
ran_li
Regular Advisor

Re: how does mailx look up the mail server

Thanks for the reply.

--'sendmail' relys on having a viable DNS running, so first, do that.

>> yes, I have viable DNS running, but the situation is my host(FQDN) is in one domain(say host1.domain1.com) and the mail server (that I wish to use) is in another domain (mailhost1.domain2.com), both DNS server are correctly configured, from host host1.domain1.com I can nslookup and ping mailhost1.domain2.com, however, each time when I use mailx or sendmail it will use another mail server for delivering (mailhost2.domain2.com) so that's why I want to know the search path. I also tried to change the domain/nameserver in resolv.conf, it does not help either.

--You need to setup the smart relay macro in '/etc/mail/sendmail.cf'. You should have something like:

DSadmin.exchange.com

...for the DS macro which should be commented-out.

>> I did above but still mail won't be sent from this server
DSmailhost1.domain2.com

--Also, add your server's hostname and FQDN to '/etc/mail/sendmail.cw' if its not already there.

>> tried same as above.

--You do *not* need to have the 'sendmail' daemon running to send out-going mails. Thus, if you wish, set SENDMAIL_SERVER=0 in ' /etc/rc.config.d/mailservs'.

>> understand, thanks.
Bill Hassell
Honored Contributor

Re: how does mailx look up the mail server

And very important: The mail server (like Exchange) will always reject mail sent to it which is not addressed to anyone on that server. You must tell your mail server admin to allow your local HP-UX to relay messages through their server.


Bill Hassell, sysadmin
ran_li
Regular Advisor

Re: how does mailx look up the mail server

Actually, all the hosts that want to send mail from have been added to the allow list at maihost1.domain2.com, somehow, mail still go through the mailhost2.domain2.com instead of mailhost1.domain2.com.
...

Thanks!
V.Tamilvanan
Honored Contributor

Re: how does mailx look up the mail server

Hi,

Check the below link and /etc/rc.config.d/mailservs file.
http://devrsrc1.external.hp.com/STK/impacts/i216.html
ran_li
Regular Advisor

Re: how does mailx look up the mail server

/etc/rc.config.d/mailservs
export SENDMAIL_SERVER=1
export SENDMAIL_SERVER_NAME=

Phillip Thayer
Esteemed Contributor

Re: how does mailx look up the mail server

Check the contects of the /etc/nsswitch.conf and make sure they are really correct. Also, shouldn't you have a specific mail server name in the
export SENDMAIL_SERVER_NAME= line? Something like:

export SENDMAIL_SERVER_NAME=mailhost1.domain2.com

Phil
Once it's in production it's all bugs after that.
ran_li
Regular Advisor

Re: how does mailx look up the mail server

/etc/nsswitch.conf
passwd: files ldap
group: files ldap
hosts: files ldap dns
networks: files ldap
protocols: files ldap
rpc: files ldap
publickey: files
netgroup: files ldap
automount: ldap files
aliases: files
services: files ldap

I don't have any value for SENDMAIL_SERVER_NAME in /etc/rc.config.d/mailservs, do I have to?

mailx does not require sendmail daemon to be runing right.

Thanks!
Kasper Haitsma
Trusted Contributor

Re: how does mailx look up the mail server

Hi,

to emulate, how sendmail is looking up the mail destination, and works out how mail will get there, type:

nslookup -q=mx
e.g.
nslookup -q=mx hp.com

this results in a list with weighed mail relays (MX records). the lowest number will be attempted first.
you can also verify if the mail relay you intnd to use has the most important MX-record for itself, from the system you are sending from (this can vary)

nslookup -q=mx mailhost1.domain2.com

if this seems in order, you can test your sendmail.cf configuration file, by starting it in testmode:

sendmail -bt
> /parse user@dest.domain.

this will give you the real mailertype, relay and "destination user" sendmail will be using
i.e.
mailer smtp, host relay.domain.com, user user@dest.domain

you need to quit test mode using
with regards to the nsswitch.conf, do you need ldap and dns for host lookup, for the applications running on the system? if not, you could just have files in this line and add mailhost1 to /etc/hosts (if sendmail can only find mailhost1, it can only use that one)

if the result of the test is not what you want, and you need to use ldap and dns for hosts lookup, you could build a new sendmail.cf:

cd /usr/newconfig/etc/mail/cf/cf
./gen_cf

and answer the questions you find appropriate

HTH

kasper
hp
It depends
ran_li
Regular Advisor

Re: how does mailx look up the mail server

Thanks for the details!

nslookup -q=mx mailhost1.domain2.com
Using /etc/hosts on: hp03

looking up FILES
Trying DNS
mailhost1.domain2.com preference = 5, mail exchanger = mailhost1.domain2.com
mailhost1.domain2.com internet address = 14x.13x.1x.1x

One of the test result that I don't understand is if I did not specify the DS entry in sendmail.cf, and this host(hp03) is NOT in the allow relay list on mailhost1.domain2.com, mail still can be send out to my corporate email account as well as Internet email account(yahoo), but the mail headers are different.

1. for the mail arrived at my corporate mailbox, the header says it uses mailhost1.domain2.com for the mail routing.

2. for the mail arrived at my internet(yahoo) mailbox, the header says it uses 2x7.1x7.5x.1x,

3. I could not lookup this IP address(2x7.1x7.5x.1x) anywhere on the internal LAN, however it can be resolved outside on the internet(outside the corporate network).

It must be a legacy mail server somewhere (because of the company's acquisition), but I m wondering what is the mail route and how the DNS and mail server configuration will affect it.

We use ldap for user authentication, automount and netgroup, it has hosts entries but we use DNS to lookup the hosts.

Regards!
gopal.ak
Occasional Visitor

Re: how does mailx look up the mail server

Hi !! ALL !
I am naive member to this forum.
The topic initiated, here would have been initaied by me today as i have to send message using mailx. SO i would like.. to have summarized , rather documented version of this usage, which will help me. So plz.. reply.. I am sure Mr ran_li will reply.. looking forward for ur replies .... & suggegstions..
ran_li
Regular Advisor

Re: how does mailx look up the mail server

gopal.ak,

what is your question or problem encountered.

Ran
ran_li
Regular Advisor

Re: how does mailx look up the mail server

gopal.ak,

Please initialize another thread for your questions, my problem is not apply to your case specifically.

Ran