For a test email with the following command
(echo "Hi") | mailx -v -r from@something.com -s "Subject Test" -c cc@something.com to@something.com
I get the following output in a particular scenario
to@something.com... Connecting to smtphostnamesomething via relay
421 4.3.2 Service not available
>>> QUIT
to@something.com... 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.
mailx
return 0 because mail was delivered locally. mailx has no way to know what will happen next.