sending attachments in mail


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers sending attachments in mail
# 1  
Java sending attachments in mail

Hi ,

i have tried the following command to send an email with an attachment
its working fine but i am getting mail with the embeded content inside the mail that too truncated.

i wanted it as an attachment.

/usr/lib/sendmail -F "MAC SIA" address "rajendra@abc.com.sg" -t < /prod/applc/ds_data/mac/working/nullctry.txt


regards
Rajesh
# 2  
Hi, for that you could use "uuencode" and "mail" commands:
Code:
(cat text.txt; uuencode /prod/applc/ds_data/mac/working/nullctry.txt /prod/applc/ds_data/mac/working/nullctry.txt) | mail rajendra@abc.com.sg

Assuming that:
- text.txt contains the body of the email, so this is optional.
- /prod/applc/ds_data/mac/working/nullctry.txt is the file you want to attach.
# 3  
thanks but the output is not in desired format

Hi grail,

i have used both the scripts

(cat nullctry.txt; uuencode /prod/applc/ds_data/mac/working/nullctry.txt /prod/applc/ds_data/mac/working/nullctry.txt) | mail RajendraP_Gora@abc.com.sg

and also

(cat nullctry.txt; uuencode nullctry.txt </prod/applc/ds_data/mac/working/nullctry.txt ) |
mail RajendraP_Gora@abc.com.sg

i could get the attachment. the problem is the lines are continious
for eg

the original is 1,2,3,4
a,b,c,d
x,y,z,i

but in mail the attachment is like this 1,2,3,4a,b,c,dx,y,z,i

thanks for your response

Reagards
Rajesh
# 4  
what is the need for seperate cat and then to use uuencode for that..

if your file is content

then use it as


uuencode content content.txt and then with mail -- this should work
# 5  
Rajendra

Do you mean that the contents of the original attached file varies from that you got in the mail? If your answer is yes, I am surprised. What I have used for this purpose is the one given below and always I used to get the file as it is.

uuencode FileNameWithPath "AttachmentName" | mailx -s "MailSubject" MailAddress

For example If I send the File abcd.xls as

uuencode /home/usr/bb/abcd.xls "AttendanceList.xls" | mailx -s "List Of Attendance" rajendra@yahoo.com

Then the file abcd.xls will be attached in the mail with the name AttendenceList.xls and the mail subject will be - List Of Attendance.

Hope this helps.
Thank you
# 6  
Thanks a lot bobby it works fine for csv :)

Thanks a lot bobby it works fine for csv Smilie

i changed it to csv and it works fine . but for txt same problem

any way my problem is resolved thanks a lot


Regards
Rajesh
# 7  
When i sent with an attachment(text file), the format for my text file is incorrect. Some of the fields went to the next line. I have already changed unix2dos.If i use EditPlus or UltraEdit to open this file, the format is what i want.How can i ensure that the text file is long enough to contain the format that i want ?

unix2dos -ascii $sqloutfile $emailoutfile
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #695
Difficulty: Easy
The Cathedral and the Bazaar: Musings on Linux and Open Source by an Accidental Revolutionary (abbreviated CatB) is an essay, and later a book, written by Alfred Hitchcock on software engineering methods.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Sending attachments via unix

OS Linux....Just curious as to why this is not working... uuencode test.txt "test.xls"|mailx -r xxx@server.com -s "validation report" emailrecipient1,emailrecipient2 Please help....Any other options do we need to use?? (3 Replies)
Discussion started by: saggiboy10
3 Replies

2. Shell Programming and Scripting

Sending Multiple Attachments using MAILX

I have created a shell scripts and wanted to email users multiple attachments using mailx. I noticed that when I do a man on mailx I see and -a option for attachments. When I run a: mailx -s "test attachments" -a include_file -a exclude_file testuser@mydomain.com (Interrupt -- one more to... (1 Reply)
Discussion started by: metallica1973
1 Replies

3. UNIX for Dummies Questions & Answers

Sending email attachments

Hello, I've search the forum, but I cannot find an answer to my specific question. I'm trying to send some files to my professor. Upon his request, I used the following: tar -cvf vh.tar vh_part1.c vh_part2.c vh_part3.c vh_part4.c vh_sample_run15.txt uuencode vh.tar vh.tar > proj1 mail... (2 Replies)
Discussion started by: venush
2 Replies

4. AIX

Send mail attachments and have a mail body

Hi, How can I send mail attachments from shell script (AIX) and have a mail body as well ? Thanks in advance. (1 Reply)
Discussion started by: shibajighosh
1 Replies

5. Shell Programming and Scripting

Sending multiple attachments

Hi people, I am new to this forums. I have a quick question I hope one of you could help me with. I am writing a script to send attachments via email. However I am having trouble when trying to send multiple attachments. Here is the code I am using: send_mail() { uuencode $TMP $TMP1 > $TMP1... (1 Reply)
Discussion started by: deo2k8
1 Replies

6. Shell Programming and Scripting

Sending text files as attachments

Hi, I have used the following command to send a text file "archiver.log" as attachment. (cat mail.log; uuencode archiver.log archiver.log; ) | mailx -s "Failure" asd@a.com : But in the mail i am not getting new lines in the text file.New Lines are getting replaced with some weird... (2 Replies)
Discussion started by: radhika03
2 Replies

7. Shell Programming and Scripting

Sending attachments using email through shell script

Hi all, I have written a shell script which sends emails with attachments to our clients. All our attachments are simple flat files (.txt format). The script is working fine and sending the attachments to the mail-ids except that, when i am sending the attachments to non-outlook users (Like... (6 Replies)
Discussion started by: symhonian
6 Replies

8. UNIX for Advanced & Expert Users

sending attachments via unix

Hi, I need to send a mail attachment from the UNIX commandline. I'm using Tru64 and the mail client thats supposed receive the attached file (an excel sheet) is Lotus Notes. Can anybody help me out? (6 Replies)
Discussion started by: Abhishek Ghose
6 Replies

9. How do I send email?

sending files as attachments

How do I send a file as an attachment on a Unix system (9 Replies)
Discussion started by: SmartJuniorUnix
9 Replies

10. UNIX for Dummies Questions & Answers

sending files as attachments

How do I send a file as an attachment on a Unix system (9 Replies)
Discussion started by: SmartJuniorUnix
9 Replies

Featured Tech Videos