Can you please tell me how to send the attachment, subject and body of the mail using mailx command.

I am using

uuencode travel$datestamp.XLS Travel$datestamp.XLS | mail -s "International Savers Tracking" [email protected] -- -f [email protected] < BodyofTheMail.txt 

its sending attachment with subject without body of the mail

1 Answer 1


You're both piping into and indirecting into mail; you can only have one standard input. Also, uuencode isn't needed. Try:

mail -s "Subject" -a /path/to/attachments/file.ext [email protected] < /path/to/messagebody.txt
  • This worked for me too. Thank you. Commented Jun 25, 2019 at 21:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .