I am trying to send an email using mailx through Automic Workload Automation 12.0's bash jobs. The message needs to have a special character, in this case the percent sign "°".
The message should have the body This is the ° sign.
, for this example.
I am using this code to send the message. printf '\xB0'
prints the ° sign.
(
printf 'This is the '
printf '\xB0'
printf ' sign.'
) | mailx [etc]
If I copy and paste this directly into a bash terminal, the email sends fine with the special character printed in the message body.
However, when I use the same code in Automic bash jobs, the email body is blank. There is a file attached, named ATT00001.bin
. If I open ATT00001.bin
using notepad.exe, the file contains the text that should have been in the body, This is the ° sign.
With the characters printed exactly as they should be in the body.
The following when used in Automic results in a message being sent with the correct body. No files are attached. So it seems clear that the special character is causing this issue with Automic.
(
printf 'This is the '
printf 'placeholder'
printf ' sign.'
) | mailx [etc]
Does anyone know why this happens, or how to resolve it?
Mailx is a evolved MUA. For just sending a mail, if you use
sendmail
, you could build your own mail header:Or you could use html encoding:
Care, use only ASCII characters there!