Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Attaching more than 2 files in mail in Unix

Tags:

unix

I am having many files to be attached and send them via email. I am running script to do so. Can you help me with code ?

like image 590
user955086 Avatar asked Jan 23 '13 06:01

user955086


People also ask

How can we attach multiple files in mail?

Select all of the files that you wish to send via email and copy them to a new folder. Now, right click on the folder and then select Send to. Selecting this will give you multiple options, look for the one that says Compressed (zipped) folder. Select this option and it will convert your folder into a zipped file.

How send multiple files in Linux?

Use mailx: The only problem is gathering the attachments with the -a option for the mailx command. This can also be done with the mutt command (note that its flags are different). To run this every XXX time units you can create a cron job.

How do I attach multiple files?

When you open the folder where the files are stored, select one and then press and hold the Ctrl Key down while you click each file you want to attach. When you are finished click the Open Button and all of the selected files will be attached.


1 Answers

You can use option -a of mailx several times, for example:

$ mailx -s 'Few files attached' -a file1.txt -a file2.txt [email protected]

You can also use uuencode like this:

$  ( cat Mail_Report.txt; uuencode file1.txt file1.txt ; uuencode file2.txt file2.txt ) | mailx -s "SUBJECT" [email protected]
like image 167
piokuc Avatar answered Dec 14 '22 08:12

piokuc