Multiple files in one mail


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Multiple files in one mail
# 1  
Old 04-09-2013
Multiple files in one mail

Hello

I'm using mail in liux to send files to users

is there a way I can send multiple file withing one mail

now I can send one file per mail

HTML Code:
mail -s "subject"   user@domain.com < /var/file
i have two more files to send file2 and fil3 but i want them to be in one mail


Thanks Sara
# 2  
Old 04-09-2013
You can also use the following syntax:
Code:
cat /var/file | mail -s "subject"   user@domain.com

So if you have multiple files then,
Code:
cat file1 file2 | mail -s "subject"   user@domain.com

# 3  
Old 04-09-2013
Quote:
Originally Posted by sachinverma
You can also use the following syntax:
Code:
cat /var/file | mail -s "subject"   user@domain.com

So if you have multiple files then,
Code:
cat file1 file2 | mail -s "subject"   user@domain.com

thanks it is working
but I want the files to be sepreated by empty lines ?
# 4  
Old 04-09-2013
Quote:
Originally Posted by Sara_84
I want the files to be sepreated by empty lines ?
Code:
{ cat file1; printf "\n"; cat file2; } | mailx -s "Subject" user@domain.com

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep strings on multiple files and output to multiple files

Hi All, I want to use egrep on multiple files and the results should be output to multiple files. I am using the below code in my shell script(working in Ksh shell). However with this code I am not attaining the desired results. #!/bin/ksh ( a="/path/file1" b="path/file2" for file in... (4 Replies)
Discussion started by: am24
4 Replies

2. Shell Programming and Scripting

Run one script on multiple files and print out multiple files.

How can I Run one script on multiple files and print out multiple files. FOR EXAMPLE i want to run script.pl on 100 files named 1.txt ....100.txt under same directory and print out corresponding file 1.gff ....100.gff.THANKS (4 Replies)
Discussion started by: grace_shen
4 Replies

3. UNIX for Dummies Questions & Answers

Run one script on multiple files and print out multiple files.

How can I run the following command on multiple files and print out the corresponding multiple files. perl script.pl genome.gff 1.txt > 1.gff However, there are multiples files of 1.txt, from 1----100.txt Thank you so much. No duplicate posting! Continue here. (0 Replies)
Discussion started by: grace_shen
0 Replies

4. Shell Programming and Scripting

awk, multiple files input and multiple files output

Hi! I'm new in awk and I need some help. I have a folder with a lot of files and I need that awk do something in each file and print a new file with the output. The input file name should be modified when I print the outpu files. Thanks in advance for help! :-) ciao (5 Replies)
Discussion started by: gabrysfe
5 Replies

5. Shell Programming and Scripting

sending multiple files along with mail message using uuencode

Hi, I have a requirement to send a mail with multiple files attached to it and along with the text message in the mail. I am trying sumthing like below but it only sends me the text message and no files attached to the mail. ---------------------------------------- ( uuencode file1... (1 Reply)
Discussion started by: sachinkl
1 Replies

6. Shell Programming and Scripting

Problem with multiple mail attachments

Hi everyone... I am facing problem with the multiple mail attachments. cd /work/mohan/pi_log/ mail_file='uuencode ahmedabad.csv ahmedabad.csv ; uuencode ahmedabad_devrpt_20110530.csv ahmedabad_devrpt_20110530.csv' ( $mail_file ) | mailx -m -s"test" domain@website.com its giving me error... (1 Reply)
Discussion started by: mohanm
1 Replies

7. Shell Programming and Scripting

Perl - match e-mail addresses in multiple files

Hi, I'm trying to write a script that will check multiple files in a directory (all the relevant filenames begin "TT04.NOTES") for e-mail addresses, and then print these addresses to screen with a count at the bottom. I'm a bit of a novice with Perl but thought it would be the best tool for the... (2 Replies)
Discussion started by: wf1974
2 Replies

8. Shell Programming and Scripting

How to send mail with multiple files attached?

Hi, I would like to send a mail with multiples files attached. Until now i was doing a "find" and then a "tar" of the text files. As I need to be able to read them on a mobile device such as Blackberry for instance, i would like to send them in one single mail, but without taring them. is... (2 Replies)
Discussion started by: Pierrito
2 Replies

9. UNIX for Dummies Questions & Answers

Using AWK: Extract data from multiple files and output to multiple new files

Hi, I'd like to process multiple files. For example: file1.txt file2.txt file3.txt Each file contains several lines of data. I want to extract a piece of data and output it to a new file. file1.txt ----> newfile1.txt file2.txt ----> newfile2.txt file3.txt ----> newfile3.txt Here is... (3 Replies)
Discussion started by: Liverpaul09
3 Replies

10. Shell Programming and Scripting

Mail to multiple reciepent

Hi, I have tried following command to send mail to a single user. cat mail_body_file.txt | mail -s "This is subject" mail_ID@somedomain.com What should I do to send a mail to number of Persons by including their mail ids in To and Cc field. (4 Replies)
Discussion started by: arpitk
4 Replies
Login or Register to Ask a Question