Our production server has been retired and now we are using a hosted system running Redhat GNU/Linux.
We had many scripts using mutt to send file attachments but they're failing now since mutt is not installed on our servers (The sysadmin policy is that mutt is not secure so it will not be installed)
I have tried using mailx but to no avail. When I do
echo "this is my email body"| mailx -s "this is my email subject" "[email protected]" -a "filename.csv"
I get
$ send-mail: illegal option -- a
"filename.csv" exist and it is local to the directory I run the command from. Of course, when I do
mailx -s "this is my email subject" "[email protected]" < "filename.csv"
It works but it embeds the file attachment in the email body. Users do not want that.
What am I doing wrong?
I figured it out. I simply moved the -a flag before the email address like so
echo "this is my email body"| mailx -s "this is my email subject" -a "filename.csv" "[email protected]"
It worked just fine.