Sample Header Ad - 728x90

Send an email with an attachment using mail command line

1 vote
0 answers
63 views
I'm trying to send an email with an attachment using the command mail but neither option -a nor -A works. * With -a:
-sh
    echo "Please, find attached the report" | mail -s "Report" -r "info@myorg.org" -a report.csv recipient@myorg.org
In this case -a is treated as a header in the email, not as an attachment. * With -A:
-sh
    echo "Please, find attached the report" | mail -s "Report" -r "info@myorg.org" -A report.csv recipient@myorg.org
In this case -A is not recognised as a valid argument to mail. The output is:
invalid option -- 'A'
I don't have mutt command available, so any help with the command mail would be much appreciated.
Asked by Cristina P. (11 rep)
May 28, 2025, 10:33 AM
Last activity: May 28, 2025, 02:57 PM