Visit Our UNIX and Linux User Community

Send Files as Attachments through email

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Send Files as Attachments through email
# 1  
Old 10-18-2011
Send Files as Attachments through email

Dear Members,

I am trying to send a file as an attachment from the command prompt in Linux.

I am using the following:

(echo "Find attached Exception Report"; uuencode $DATA_TOP/out/data/$err_rpt_file $err_rpt_file)|/bin/mailx -s "***Exceptions Found"

Here err_rpt_file variable contains the actual file name(eg : test.txt).

I am getting the email with attachment without any problem, but when i open the test.txt file in notepad every thing is wrapping up in a single line and i see carriage returns at the end of each line. When i view text.txt in linux via VI editor it looks perfect. Not sure what is happening there; uuencode is some how putting those carriage returns at the end of each line. Not sure how to resolve this problem.

Your Comments are greatly appreciated.

# 2  
Old 10-18-2011
(echo "Find attached Exception Report"; uuencode $DATA_TOP/out/data/$err_rpt_file $err_rpt_file)| \ux2dos  |/bin/mailx -s "***Exceptions Found"

# 3  
Old 10-18-2011
ux2dos does not exist on our system. I got the following error:

ksh: unix2dos: not found

We are on Linux x86_64

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash for checking and copy Daily files and send an email

Hello, Trying to get a bash for files received on daily basis and want to copy those files to different directory and send an email notification if file exists then send the file counts else Alert with no file received. FileName format: DailyTransaction_2015-03-09_ 200.csv before 200 their is... (1 Reply)
Discussion started by: krux_rap
1 Replies

2. Red Hat

How to send mail with multiple attachments?

We don't have uuencode installed in our machines..... Please tell me how to send mail with multiple attachments ??? URGENT !!!!! Please tell me using command line (or) scripts.......... please...... Thanks in Advance.... (1 Reply)
Discussion started by: vamshigvk475
1 Replies

3. Shell Programming and Scripting

How to send email with multiple attachments ?

Hello , I am trying to send an email with two attachments . I have tried all previous suggestion in this forum but none worked. I could send one attachment in an email by uuencode $file "$file" | mailx -m -s "File" but unable to send multiple attachments . I have tried ... (8 Replies)
Discussion started by: RaviTej
8 Replies

4. Shell Programming and Scripting

Script to send email after comparing the folder permissions to a certain permission & send email

Hello , I am trying to write a unix shell script to compare folder permission to say drwxr-x-wx and then send an email to my id in case the folders don't have the drwxr-x-wx permissions set for them . I have been trying to come up with a script for few days now , pls help me:( (2 Replies)
Discussion started by: nairshar
2 Replies

5. Shell Programming and Scripting

need to send files to an email id

Hi,I would like to send all the files in a particular folder to an e-mail id .I am able to send a particular file via email but that gets displayed in the email as content using the mailx option. I just want to view it in the mailbox as an attached file. Could you please help me out in... (1 Reply)
Discussion started by: arunkumarmc
1 Replies

6. HP-UX

Sending Unix files as attachments in an email

Hi, I am executing the following command in order to send a file as an attachment: mailx -s "Subject" < Testfile.txt Instead of attaching the file Testfile.txt, it is writing the contents of the file in the email message body. Please advise on how I can send the file as an... (7 Replies)
Discussion started by: sangharsh
7 Replies

7. UNIX for Advanced & Expert Users

send attachments using send mail in Solaris

Hi All, I have a requirement to send and email of body html with an attachment. concatinating uuencode output to the mail body with mailx command works, but as my Email body is of HTML type i use sendmail. my command to send HTML body is as below: export MAILTO=""... (1 Reply)
Discussion started by: mohan_kumarcs
1 Replies

8. UNIX for Dummies Questions & Answers

Counting Files and send an email Notification if it exceeds a limit

Hi, I am trying to write a script to Count Files in a directory located on a remote server and send an email Notification if it exceeds a limit. The code given below doesnot check the condition and sends the mail everytime irrespective of the condition. I have put this script in the cron. Can... (10 Replies)
Discussion started by: amitsayshii
10 Replies

9. UNIX for Dummies Questions & Answers

Email Attachments

I use metasend to send an attachment to an email. The attached file has a .csv extension however when the email is received the extension is changed to .att. Does anyone know why ? I need the name to remain as .csv (1 Reply)
Discussion started by: fabbas
1 Replies

Featured Tech Videos