Mailx issue

Hi guys

I am trying to send an email using mailx function and want the message body to appear on different lines.
My code is :

WT=`echo "Tapes are : $x Holder are : $y" `
       
 echo $WT|mailx -s "Alert" xyx@abc.com

I want to receive the email like this:

Tapes are :2
Holders are :3

Instead it is displaying as :
Tapes are :2 Holders are : 3

I used this aswell :

WT=`echo -e "Tapes are : $x \n Holder are : $y" `

But it dosent help.......

Regards

No need to assign it to a variable, simply do:-

echo "Tapes are : $x
Holders are : $y" | mailx -s "Alert" xyz@abc.com
2 Likes

Thanks. Worked perfectly !