0

For a test email with the following command

(echo "Hi") | mailx -v -r [email protected]  -s "Subject Test" -c [email protected] [email protected]

I get the following output in a particular scenario

[email protected]... Connecting to smtphostnamesomething via relay
421 4.3.2 Service not available
>>> QUIT
[email protected]... Deferred: No such file or directory
Closing connection to smtphostnamesomething.

I understand the root cause and my team has solved it however my major concern is the return value we get in this scenario from the mailx command.. which is 0 (successfull)

Usually in any kind of scenario where there is an error in sending mail the return is != 0.

In these scenarios my mail is not sent, while the service which is trying to send mail thinks that it has send because of 0 return value.

Is there anyway we can handle the return value or a way to check the service status before hand if it is actually sending mails or not!!!

Also some other checks that I did and corresponding outputs ..

ps -ef|grep sendmail

root  3277280  2228680   0   Aug 31      -  0:18 sendmail: rejecting new messages: min free: 100

lssrc -s sendmail

Subsystem         Group            PID          Status
sendmail         mail             3277280      active

Thanks.

2
  • sending mail is a two step command, mailx return 0 because mail was delivered locally. mailx has no way to know what will happen next.
    – Archemar
    Sep 17, 2020 at 7:05
  • @Archemar what is the best way to check the 2nd step. As in I want to check if the service is sending mails or now using a command and its return?
    – pOrinG
    Sep 17, 2020 at 7:44

1 Answer 1

0

It seems that your sendmail rejects new messages due to low free disk space.
Check free space on filesystem with sendmail queue directories and free some space if it is low.

http://etutorials.org/Server+Administration/Sendmail/Part+III+The+Configuration+File/Chapter+24.+The+O+Options+Configuration+Command/MinFreeBlocks/

2
  • When I checked the status, the storage was only 3% utlized. The root cause was actually from the exchange where they revoked our server rights to communicate with it. My question is how to check from unix if the service is active or not. I already have few commands but it doesnt seem full proof (eg. lssrc is still active)
    – pOrinG
    Sep 17, 2020 at 13:22
  • Although I understand that the storage issue might have caused the rejecting new messages alert but it got might have automatically cleared while I started facing service issue.
    – pOrinG
    Sep 17, 2020 at 13:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .