Sample Header Ad - 728x90

send e-mail with mailx in a bash script waiting if needed for the outcome

0 votes
1 answer
839 views
I'm writing a bash script that sends an e-mail with attachment to the local user root. I noticed that mailx forks some helper program and terminates instantly with exit status 0 even when the command line arguments are invalid:
localhost:~/basinsrv # mailx -s aaa root -a bbb 
How to make mailx wait for the outcome and terminate with proper error code? Actually, I need to post-process the generated mail before it's sent. Is it possible to not actually send the message and only save it to a file? mailx-12.5-31.7.x86_64 postfix-3.6.2-7.1.x86_64
Asked by basin (2121 rep)
Feb 8, 2023, 07:56 PM
Last activity: Feb 8, 2023, 10:17 PM