Messaging
cancel
Showing results for 
Search instead for 
Did you mean: 

sendmail not working (used to work...)

tom_2010
Occasional Advisor

sendmail not working (used to work...)

Hi.
Sorry I'm new to HP-UNIX and need help to solve sendmail problem.

My sendmail suddenly fails to send e-mail and
mail.log says
"Deferred: Connection timed out with xx.xx.xx.xx."
Looking at mail.log, I found "relay=xx.xx.xx.xx"
has changed from "relay=aa.aa.aa.aa." to
"relay=bb.bb.bb.bb" (aa and bb are just examples) but I haven't changed any config like sendmail.cf.

How does sendmail determine relay info? Where should I look at?
Could anyone help??
My HP-UNIX version is HP-UX 11i v1

Thank you.
15 REPLIES

Re: sendmail not working (used to work...)

Hi,

Please dont panic...

Just try to stop and then restart the sendmail

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

and then please look into
/var/adm/syslog/mail.log for more info

if its not working
then please check domain name in the file /etc/resolv.conf
Matti_Kurkela
Honored Contributor

Re: sendmail not working (used to work...)

If your sendmail is in HP-UX default configuration, it will use the Mail Exchanger records in the DNS system to find the relay server separately for each destination address. Effectively, it's trying to deliver each mail as directly as possible to the recipient's mail server.

To run the equivalent DNS query manually, find the FQDN part of the mail address and run nslookup on it using the "-query=mx" option.
For example, if the mail recipient is "Joe.Blow@company.example", then run:

nslookup -query=mx company.example

If there are no MX records in the DNS for the mail recipient, sendmail will (by default) try to contact the recipient host (here "company.example") directly. If that fails too, the mail is undeliverable and a bounce message will be sent to the sender.


In these days, it's the standard practice to allow only the organization's "main" mail server(s) to work like that: all the others are usually configured to send all outgoing mail to the main server(s) only. This is called a "smart host configuration".

Open /etc/mail/sendmail.cf using your favorite editor and search for the string "DS" in all-caps. You'll find a lot of comments describing how to set the smart host configuration, and after the comments, the actual configuration line:

# "Smart" relay host (may be null)
DS

If there is no hostname or IP address after the letters "DS", smart host is not configured.

MK
MK
tom_2010
Occasional Advisor

Re: sendmail not working (used to work...)

Deepankar, MK,

Thank you for response.

I tried method you've suggested, but not working...

Here is (part of) my mail.log.

******************************************
Jul 9 11:30:03 xxx00001 sendmail[8337]: LAA08277: to=aaa@bbb.com, ctladdr=xxxxx (3002/500), delay=00:00:01, xdelay=00:00:00, mailer=esmtp, relay=mail.xxxxx.com. [xxx.xxx.xx.xx], stat=Sent (Ok: queued as 4A6C312D6C1)

Jul 9 11:41:19 xxx00001 sendmail[17650]: LAA17606: to=aaa@bbb.com, ctladdr=xxxxx (3002/500), delay=00:01:17, xdelay=00:01:17, mailer=esmtp, relay=mail.yyyyy.com. [yyy.yyy.yy.yy], stat=Deferred: Connection timed out with mail.yyyyy.com.
******************************************

An e-mail sent at 11:30:03 was sent successfully, but e-mail sent at 11:41:19 was not.
Strange thing is "relay=" part of mail.log is changed from "relay=mail.xxxxx.com." to
"relay=mail.yyyyy.com".
It seems like sendmail is trying to access mail.yyyyy.com, but it does not exist
(i tried to ping this server but couldn't).

I typed "nslookup -query=mx xxxxx.yyyyy" (where xxxxx.yyyyy is equivalent to mail.xxxxx.com in mail.log)
and it works fine.
I set Smart-relay host to mail.xxxxx.com and restarted sendmail,
but nothing changed.

As I mentioned in the first post, I haven't changed any config like sendmail.cf, host, resolv etc.
It seems like sendmail suddenly started to act different way.
I'm wondering how sendmail determines "relay=" part...

Thank you
Horia Chirculescu
Honored Contributor

Re: sendmail not working (used to work...)

What is your (post the corresponding line) "Smart" relay host:

DS

from sendmail.cf?

Best regards,
Horia.
Best regards from Romania,
Horia.
tom_2010
Occasional Advisor

Re: sendmail not working (used to work...)


Horia,

Here is my sendmail.cf DS line

DS999.999.99.99
(where 999.999.99.99 is IP address of the server "mail.yyyyy.com
in my previous post)

I tried telnet to this IP address with port 25,
connected successfully and could send e-mail.

Should i change any other config files if I use Smart relay??

Thank you
Bill Hassell
Honored Contributor

Re: sendmail not working (used to work...)

Use sendmail -v to trace the mail transactions:

sendmail -v aaa@bbb.com < /etc/profile

Then post the results. The mail.log file is not very clear about the actual transaction.


Bill Hassell, sysadmin
tom_2010
Occasional Advisor

Re: sendmail not working (used to work...)

Bill

Thank you for your response.
I've tried to send e-mail to my e-mail account using sendmail command,
and below is the trace result.

----------------------------------------------------------
sendmail -v aaaaa@bbbbb.com
TEST MAIL
.
aaaaa@bbbbb.com Connecting to mail.yyyyy.com. via relay...
aaaaa@bbbbb.com Deferred: Connection timed out with mail.yyyyy.com.
----------------------------------------------------------
(aaaaa@bbbbb.com and mail.yyyyy.com are not actual values)


One thing I'm not clear is although I set Smart-Relay (DS in sendmail.cf)
to testtest.com (where test.com does not exist. I wanted to see
if Smart-relaying function is working) and restarted sendmail service.
Then I send e-mail by typing sendmail command directly but
nothing changed.
I mean, sendmail is not trying to connect the server I set in sendmail.cf.

Could anyone pls help... as it's been a couple days past and so many mails
are in mail queue.
Bill Hassell
Honored Contributor

Re: sendmail not working (used to work...)

> I mean, sendmail is not trying to connect the server I set in sendmail.cf.

Did you restart sendmail (use /sbin.init.d/sendmail stop/start)? To get rid of DNS problems, specify the smart relay as an IP address and verify that you can telnet to the smart relay on port 25:

telnet 12.34.56.78 25
Trying...
Connected to smart.relay.org.
Escape character is '^]'.
220 ************************************
quit
221 Bye
Connection closed by foreign host.



Bill Hassell, sysadmin
tom_2010
Occasional Advisor

Re: sendmail not working (used to work...)

Bill,

Thank you for response.

There's an improvement.

I set my sendmail.cf line to specific relay server like [aaaaa.com] (I put square-blackets)
and restarted sendmail service.
Now sendmail has began to use the relay server
specified in sendmail.cf.

I tried to send e-mail to my e-mail account by typing "sendmail -v myaccount@aaa.com ". Sending process looks fine, but e-mail was not sent to me because "RCPT To:" is wrong.
It looks like sendmail appends domain name (looks like domain name but not sure) like
"RCPT To:
How can i fix this?



Anshumali
Esteemed Contributor

Re: sendmail not working (used to work...)

To see whether its appending the DNS name in RCPT TO, you can use:
sendmail -v -d7.99 -d38.9 user_name@domain.com
It should be visible there in my opinion. From here, you can get the clue to fix it.
Dreams are not which you see while sleeping, Dreams are which doesnt allow you to sleep while you are chasing for them!!
tom_2010
Occasional Advisor

Re: sendmail not working (used to work...)

Anshumali,

Thank you very much for the script.
Though I run the given script, I'm not clear if sendmail appends domain name etc.

Below is a part of sendmail log.
--------------------------------------
>>> EHLO myserver.com
250-mailserver.com Hello [xx.xxx.xx.xx]
250-TURN
250-SIZE
250-ETRN
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-8bitmime
250-BINARYMIME
250-CHUNKING
250-VRFY
250-X-EXPS GSSAPI NTLM LOGIN
250-X-EXPS=LOGIN
250-AUTH GSSAPI NTLM LOGIN
250-AUTH=LOGIN
250-X-LINK2STATE
250-XEXCH50
250 OK
>>> MAIL From:
250 2.1.0 wwwww@myserver.com....Sender OK
>>> RCPT To:
250 2.1.5 aaaaa@bbbbb.com.xxxxx.zzzzz.com
>>> DATA
------------------------------------------

I just want sendmail not to put xxxxx.zzzzz.com after aaaaa@bbbbb.com in RCPT To field. Everything looks OK except RCPT To field.

Would you pls give me a clue to make this work?



Anshumali
Esteemed Contributor

Re: sendmail not working (used to work...)

whats coming above ">>> EHLO myserver.com"
May be there is a clue how its appending. Would you be able to paste that, espcially where its resolving the names and domains....
Is there anything other layer, like spam filters etc....
Dreams are not which you see while sleeping, Dreams are which doesnt allow you to sleep while you are chasing for them!!
tom_2010
Occasional Advisor

Re: sendmail not working (used to work...)

Anshumali,

Thanks for advice.
Here is what i get.

-------------------------------------------
sendmail -v -d7.99 -d38.9 user_name@domain.com
seq_map_parse(aliases.files, )
map_init(sequence:aliases.files, NULL, 0)
sequence:aliases.files NULL: valid
map_init(implicit:Alias0, /etc/mail/aliases, 0)
wrong pass (pass = 0, rebuildable = 1)
map_init(host:host, NULL, 0)
host:host NULL: valid
map_init(switch:aliases, aliases, 0)
switch_map_open(aliases, aliases, 0)
map_stack[0] = sequence:aliases.files
switch:aliases aliases: valid
map_init(dequote:dequote, NULL, 0)
dequote:dequote NULL: valid
map_init(sequence:aliases.files, NULL, 1)
wrong pass (pass = 1, rebuildable = 0)
map_init(implicit:Alias0, /etc/mail/aliases, 1)
impl_map_open(Alias0, /etc/mail/aliases, 0)
hash_map_open(Alias0, /etc/mail/aliases, 0)
implicit:Alias0 /etc/mail/aliases: valid
map_init(host:host, NULL, 1)
wrong pass (pass = 1, rebuildable = 0)
map_init(switch:aliases, aliases, 1)
wrong pass (pass = 1, rebuildable = 0)
map_init(dequote:dequote, NULL, 1)
wrong pass (pass = 1, rebuildable = 0)
queuename: trying "qfNAA25807"
queuename: assigned id NAA25807, env=40019f38
lockfd= 4: fl=0x1, mode=100600: size=0
queuename: xfNAA25807
queuename: dfNAA25807
queuename: tfNAA25807
user_name@domain.com... Connecting to [xx.xxx.xxx.x] via relay...
-------------------------------------------

It looks like sendmail is looking at aliases file in /etc/mail. I dont think aliases file relates to this issue but let me paste contents of aliases file just for info.

--------------------------------------
# Alias for mailer daemon
MAILER-DAEMON : root

# RFC 822 requires that every host have a mail address "postmaster"
postmaster : root

# Aliases to handle mail to msgs and news
nobody : /dev/null

# System Admistration aliases
operator : root
uucp : root
daemon : root

# Ftp maintainer.
ftp-bugs : root

# Local aliases
--------------------------------------

Hope you can find something from the above.
Let me know if more details are required.

BTW, when i directly telnet to mail server and sends e-mail thru SMTP conversation, it works fine and RCPT TO address does not have duplicated host name. Is it because i directly input recipient address?
tom_2010
Occasional Advisor

Re: sendmail not working (used to work...)

Hi all.

Problem seems to be (temporalily) fixed by adding # to
R$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4 in sendmail.cf's ruleset 96.

I know this is just a workaround and still need to work on this issue, but now sendmail functions started to work properly.

I really appreciate everyone's replies.
tom_2010
Occasional Advisor

Re: sendmail not working (used to work...)

Found workaround so this thread is closed.