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" abc@gmail.com -- -f abcd@gmail.com < 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 mailbox@example.com < /path/to/messagebody.txt
  • This worked for me too. Thank you. Jun 25, 2019 at 21:36

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.