Sending Unix files as attachments in an email


 
Thread Tools Search this Thread
Operating Systems HP-UX Sending Unix files as attachments in an email
# 1  
Old 02-02-2010
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" emailID@xyz.com < 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 attachment.

Thanks!!!
# 2  
Old 02-02-2010
the "<" tells the command to take input from whatever is on the other side of it.

https://www.unix.com/unix-advanced-ex...ing-mailx.html
# 3  
Old 02-02-2010
Thanks. But if I remove "<" , then where can I mention the attachment file name?
I tried "cat Testfile.txt | mailx -s "Subject" emailID@xyz.com" as well as "uuencode Testfile.txt | mailx -s "Subject" emailID@xyz.com".
Both of them gave me the same result...Contents of Testfile.txt in the email body..The file did not come as an attachment. Please advise.
# 4  
Old 02-02-2010
Code:
cat file|uuencode file|mailx -s "subject" address

is that command you are running?

you may try parenthesizing the command for attaching the file:

Code:
(cat file|uuencode file)|mailx -s "subject" address

# 5  
Old 02-03-2010
Code:
   cat Testfile.txt | ux2dos | mailx -s    " blah blah subject"   Emailaddress, emailaddress


Last edited by vbe; 02-03-2010 at 05:44 AM.. Reason: made one-liner
# 6  
Old 02-03-2010
Thanks for your suggestions...But none of these worked..In all these cases, the file content is coming as the message body...may be soem version difference...Anyways, I have to go ahead with it...So, implementing with the file as message body Smilie
# 7  
Old 02-04-2010
try the following:

uuencode zz.sh zz.sh > mail.txt; cat mail.txt | mailx -s "subject" email_address
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Mailx sending attachments to personal email, but not SharePoint?

Hello! I am writing a KornShell script that (in addition to other things) sends a file from a Unix directory to a SharePoint directory. However when executing the script there is no sign of the file on the SharePoint. I have tested the script using my personal email as the destination and the... (3 Replies)
Discussion started by: mattkoz
3 Replies

2. Shell Programming and Scripting

Sending an email with a body and attachments using uuencode

Hi, Im having a bit of an issue with using the uuencode command and sending out an email. My aim is to send an email out which has a body and also have attachments. Currently I can either get one or the other and not both on the same email. uuencode... (4 Replies)
Discussion started by: 02JayJay02
4 Replies

3. 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

4. Shell Programming and Scripting

unix email attachments in web mail

Hi, Request you to please help on my issue. My issue is: We are able to send the log files as an email attachment. We are able to get the attachment in our inbox. But when we try to see in web mail, instead of the attachment, junk characters are displaying. Appreciate your help. Regards,... (10 Replies)
Discussion started by: gi.srinivas
10 Replies

5. 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

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
Login or Register to Ask a Question