Sending csv file as an attachement from Linux


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sending csv file as an attachement from Linux
# 1  
Old 10-09-2014
Sending csv file as an attachement from Linux

Hi i am trying to send a csv file as an attachment via mail from linux.
i am using the below script.
Code:
echo "X-Mailer: htmlmail" $VERSION
echo "Mime-Version: 1.0"
echo 'Content-Type: multipart/mixed; boundary="-q1w2e3r4t5"'
echo '---q1w2e3r4t5'
echo "Content-Type: text/html; charset=US-ASCII"
echo '---q1w2e3r4t5'
                  echo 'Content-Type: TEXT/CSV; name='$files
                 echo 'Content-Disposition: attachment; filename="'$(basename $files)'"'
                  cat $files
echo '---q1w2e3r4t5--'

csv file contains a row with 200 columns.when i try to open the excel after receiving in a mail the single row got splitted into multiple rows.
when i try to open the file in vim editor its showing as single line.
I am using GNU/LINUX.
Pls help me to sort this out.Thanks for your help
# 2  
Old 10-09-2014
Most folks use uuencode. Example...

Code:
 $ uuencode file.dat file.dat | mail user@someplace.com

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Send file attachement in mail

Hello, I am able to attache the file in UNIX/LINUX script using following code. MAILFORMAT="Please do not replay this mail.This mail is auto generated." echo -e $MAILFORMAT | mailx -r autoreplay@gmail.com -a filename -s "status" xyz@gmail.com But same I am not able attache... (6 Replies)
Discussion started by: nes
6 Replies

2. Shell Programming and Scripting

Mail sending with multiple attachement(pdf and csv) with html content from Linux

Hi, We have a requirement to send multiple attachment(pdf and csv) along with html content in a single mail. For that we are using uuencode. It is working for single pdf attachment and html content. But we are unable to send both pdf and csv attachment with html content. Below is the script.... (5 Replies)
Discussion started by: dholea
5 Replies

3. Shell Programming and Scripting

Comparing 2 CSV files and sending the difference to a new csv file

(say) I have 2 csv files - file1.csv & file2.csv as mentioned below: file1.csv ID,version,cost 1000,1,30 2000,2,40 3000,3,50 4000,4,60 file2.csv ID,version,cost 1000,1,30 2000,2,45 3000,4,55 6000,5,70 ... (1 Reply)
Discussion started by: Naresh101
1 Replies

4. Shell Programming and Scripting

Attaching .csv file and sending email

I need help with writing a shell script for writing data from a table into a .csv file and send the file has email attachment. I stuck up with attaching the file to the email. Thanks, (1 Reply)
Discussion started by: Beena
1 Replies

5. Shell Programming and Scripting

How to embed a html file in a mail sending from Linux box with uuencode or mailx?

How to embed a html file as subject in a mail sending from Linux box with uuencode or mailx or any other way? we do not want the file as attachment, it should be embedded in the mail subject. (2 Replies)
Discussion started by: johnveslin
2 Replies

6. Programming

help me about sending file through socket udp with c in linux

hi, i am newbie of socket. i want to ask some question. if i want to send file from client to server, how do i do? and if i want to send file from server to client, how do i do? any pro help me and if possible, you can post code for an example i need it very much thank you for helping me:)... (1 Reply)
Discussion started by: tung1984
1 Replies

7. Shell Programming and Scripting

sending attachement in mail

Hi , I am using the below code to send mail through a script which run as a cron job. msgdate=`date +"%a, %e %Y %T %z"` daemail=$(cat <<! From: $from To: $emailtarget Subject: $subject Mime-Version: 1.0 Content-Type: multipart/mixed; Content-Disposition: inline $priority $CONTENT !)... (2 Replies)
Discussion started by: ahamed
2 Replies

8. Shell Programming and Scripting

Sending attachement using mailx

Hi I tried reading docs from this forum and googled it...but i couldnt get the answer for attaching a document in mail. I need it to be the actual attachement not adding the content of the file to the body of the mail.. i used uuencode ...to encode the file but it is coming as a junk... (4 Replies)
Discussion started by: aemunathan
4 Replies

9. Shell Programming and Scripting

Email sending attachement with two file comparision

Hi guys, I have two files . One file contains log record and another file contains emailids which is supposed to send it users File1 : Name : abc_xyz_data.txt Which contains log record File 2 : Name : abc_xyz_mailids.txt Which contains emailids. abc@test.com bcd@test.com I... (4 Replies)
Discussion started by: orabalu
4 Replies

10. UNIX for Dummies Questions & Answers

Send a mail with an attachement of a file

I wanted to try sending a mail with an attachement at command prompt in unix. Some one please advise that how we can do it ? Thanks, :) (2 Replies)
Discussion started by: gaddeg
2 Replies
Login or Register to Ask a Question