How to send a attachment


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to send a attachment
# 1  
Old 06-17-2008
Question How to send a attachment

Hi,

I want to send a attachment using mailx command and also i want to include body of the mail which is stored in a text file.Smilie
Code:
uuencode att.txt att.txt |mailx -s "attachment" adc@mail.com < text.txt

I tried this command, but it is not working fine. It is showing the body but it is not sending the attachment. Please help

Thanks,
Lathish

Last edited by Yogesh Sawant; 06-17-2008 at 08:36 AM.. Reason: added code tags
# 2  
Old 06-17-2008
Hammer & Screwdriver I experienced the same issue

I found that with mailx, I could either make an attachment OR pass a message. But, I could not do both. Because of the nature of my specifics, I often had more than one attachment. Thus, I created a loop to send all my attachment messages one-at-a-time, and then send a summary email.

Code:
uuencode att.txt att.txt |mailx -s "attachment" adc@mail.com 
mailx -s "attachment summary" adc@mail.com < text.txt

I have been told that there are other mail utilities available for unix that can accomodate the attachment and message. Perhaps someone here can add the name(s) of other utilities. [Or, let us know how to get the syntax to work.]
# 3  
Old 06-17-2008
Bug

Quote:
Originally Posted by joeyg
I found that with mailx, I could either make an attachment OR pass a message. But, I could not do both. Because of the nature of my specifics, I often had more than one attachment. Thus, I created a loop to send all my attachment messages one-at-a-time, and then send a summary email.

Code:
uuencode att.txt att.txt |mailx -s "attachment" adc@mail.com 
mailx -s "attachment summary" adc@mail.com < text.txt

I have been told that there are other mail utilities available for unix that can accomodate the attachment and message. Perhaps someone here can add the name(s) of other utilities. [Or, let us know how to get the syntax to work.]
Thanks joeyg for your solution.

But i found how to send the summary report and attachment in a single mail command,

(cat text.txt uuencode att.txt att.txt) |mailx -s "attachment" adc@mail.com
mailx -s "attachment summary" adc@mail.com


Hope this wlll help you.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Send Mail With Attachment

Hi, I need to send attachment with email as external attachment. Presently, we are using uuencode to make an attachment but it is going as content of body. We are using below command. uuencode "filename1" "filename2" | mailx -r "$SENDFROM" ${SENDTO} In unix box, -a is not supportable... (1 Reply)
Discussion started by: vamshi929
1 Replies

2. Shell Programming and Scripting

Send attachment through sendmail

Hi, I am trying to send log file of a job run in unix machince through sendmail.Though I am able to send the text but it is not sending as attachment. Could you please look into the code and let me know where I have gone wrong fdate=`date %Y%j`... (2 Replies)
Discussion started by: Rossdba
2 Replies

3. Shell Programming and Scripting

Send mail as attachment

Hi All, I am trying to send mail via unix and attaching file along with that mail, but facing issue while sending. I have tried below commands- 1)- uuencode $prmDirOutput/report_mailbody $prmDirOutput/report_mailbody | mailx -s "Acknowledgment file- $subject" $email_id 2)- mutt -a... (4 Replies)
Discussion started by: Amit786
4 Replies

4. Shell Programming and Scripting

Send mail using attachment

Hi All, I need to send mail with attachment. I am using uuencode but it seems it is sending encoded file. I am getting the mail with attachment but there is no data even the file size is almost 90KB. Please help. Thanks. (3 Replies)
Discussion started by: unankix
3 Replies

5. Shell Programming and Scripting

How to send attachment without using uuencode

H All I want to send attachment in mail but I dont have uuencode installed in AIX server, there is any alternative way to send attachment in mail. (2 Replies)
Discussion started by: ns64110
2 Replies

6. Shell Programming and Scripting

How to send a mail with attachment?

Hi, I usually write a file TEST.MAIL like this to send mails: Importance: High Priority: Urgent X-Priority: 1 (Highest) From: user Subject: error ... text body .... and then I launch it (or writre a c-chell that launchs it) by writing: mail a@b.com < /users/.../TEST.MAIL How can... (4 Replies)
Discussion started by: albaalbetti
4 Replies

7. Shell Programming and Scripting

Send attachment in Linux

Hi, I have searched the site for info on sending an attachment in Linux, have tried a few people mailx codes but to no success. Can someone please help me? This is what i have so far: #!/bin/bash user_mail_address="me@yahoo.com" filename="attachment.txt" body="This is the body" mail -s... (6 Replies)
Discussion started by: shamushamu
6 Replies

8. UNIX for Advanced & Expert Users

send attachment without uuencode

Hello - In unix, can you tell me IF there is a way to send attachments via email without using uuencode command? Thank you (3 Replies)
Discussion started by: panchpan
3 Replies

9. UNIX for Dummies Questions & Answers

Send an attachment with metasend

Hi, How to send an attachment of which the name contains the space. Following is the command I tried. metasend -b -s "test subject" -F "test@yahoo.com" -t "test@test.com" -f "test.txt" -m "text/plain" -n -f "test 123.txt" -m "application/xls" If the file name contains no space,... (0 Replies)
Discussion started by: egckhad
0 Replies
Login or Register to Ask a Question