Message body not sending using mailx

I've just upgraded a 16.04 LTS machine to 18.04 LTS. Since doing that a script has not been sending emails in the same way. It pipes the message body to mailx and also attaches a file. The original script had the following:

cat <<EOF | /usr/bin/mailx -s "$HOSTNAME Server Update" -a $LOGFILE $RECIP
This is the output from the safe-upgrade on $HOSTNAME run on
`date`
EOF

I discovered that the attachment option needed changed to -A so modified that. The email sends and contains the attachment but there is no body text. I tried changing it to this:

echo "This is the output from the safe-upgrade on $HOSTNAME run on `date`" | /usr/bin/mailx -s "$HOSTNAME Server Update" -A $LOGFILE $RECIP

But this made no difference. Any suggestions? Is it just a quirk with the recipient's mail client (Outlook/MS Exchange)?

Thanks

4 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like