Issue
I have list of excel files in a directory. I'm trying to email those files as attachment. However, when I open the email, I could see only one file as attachment. The below script is not attaching multiple files as attachment.
ls *.xls;
#echo "Test Email" | mailx -s "Testing File Conv" -a *.xls [email protected]
Will the above script work?
Solution
You have to write a script for this. at first create test.txt
.
ls *.xls -1 > test.txt
then run this script :
while read line
do
mailx -s "Subject" -a ${line} -s "files" ${mail_from} << EOM
Hi, Sent files
EOM
done<test.txt
Answered By - rezshar Answer Checked By - Willingham (WPSolving Volunteer)