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
Sarah Jenkins

Sarah Jenkins

Senior Technology Editor & AI Specialist

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.

Share this article