1

I am trying to use mail command to send 2 attachments. The issue which i am facing is unable to send attachment and mail body content. tried following command

echo "Hello World" | mail -s 'Test Email' -A test.csv -aFrom:no-reply@test.com abcd@test.com 
cat README.txt | mail -s 'Test Email' -A test.csv -aFrom:no-reply@test.com abcd@test.com 
mail -s 'Test Email' -A test.csv -aFrom:no-reply@test.com abcd@test.com < README.txt

Whereas I send mail body alone then mail is received with body

mail -s 'Test Email' -aFrom:no-reply@test.com abcd@test.com  < README.txt

How to send both attachment and mail body (README.txt in mail body and test.csv in attachment)?

  • You mean you want send README.txt and test.csv, both, in attachment? – αғsнιη May 17 at 5:04
  • README.txt is mail body and test.csv in attachment – Murugan M May 17 at 5:10
  • -a is used to send attachments not -A – αғsнιη May 17 at 5:15
  • In man mail it shows -A, --attach=FILE, -a, --append=HEADER: VALUE append given header to the message being sent – Murugan M May 17 at 5:20
  • Done. its 18.04.1-Ubuntu – Murugan M May 17 at 5:29

Your Answer

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

Browse other questions tagged or ask your own question.