Sent an email attachment, but the attachment is empty


 
Thread Tools Search this Thread
Operating Systems Solaris Sent an email attachment, but the attachment is empty
# 1  
Old 08-15-2012
Sent an email attachment, but the attachment is empty

I'm trying to send a .zip file from my unix box to my work email (email client outlook)

The file name that I'm trying to sent is sites.zip and this is how I do it:
Code:
uuencode sites.zip | mailx -s "testing" myname@mydomain.com

When I open the .zip, the zip is empty. Looking around the we, I see that the reason is that I need to convert from unix format to dos format and I can do that by using unix2dos. But when I try I get an error:

Code:
unix2dos sites.zip | mailx -s   myname@mydomain.com
could not open /dev/kbd to get keyboard type US keyboard assumed
could not get keyboard type US keyboard assumed

Thanks in advance
# 2  
Old 08-15-2012
You cannot use unix2dos on binary files, it will render the zip unreadable for the unzip. Instead, you will have to uuencode, mail, and then run uudecode on the DOS side to reverse the changes made by uuencode. Then you should be able to unzip the file.
# 3  
Old 08-15-2012
Is there any other way to do it that I don't have to do anything on the other end? because I'm doing an script and I don't want the user do anything on their end. Thanks for your fast reply
# 4  
Old 08-15-2012
What you were doing never made sense in the first place. Any other way to do what?

If you want the contents of the zip to be converted, convert the files before you zip them...
# 5  
Old 08-15-2012
As Corona668 said, convert should be the first thing you do, IF those are text files, which you did not mention. In case they are:
unix2dos files; zip files; uuencode .zip; mail .zip; uudecode .zip; unzip files --> there you are, you have your unzipped, converted files on your DOS side.

Last edited by RudiC; 08-15-2012 at 02:05 PM.. Reason: typo corrected
# 6  
Old 08-15-2012
No guarantees (you'll need to dry run this) but I find that some Windows compression utilities (eg. WinRAR) can unpack native unix tar files.

I've used such functionalities in production environments quite successfully.
# 7  
Old 08-15-2012
I just did a test, The file that I want to send as an attachment is named text_file.txt
Code:
unix2dos text_file.txt

Then I sent it as an attachment likr this
Code:
uuencode text_file.txt  | mailx -s "test" myname@domain.com

But when I received the file, the file was empty.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Attachment in email

I have a file in unix, while i do email that file to some one from unix, the attachment file data is displaying in the email. (as body of the email). but if the file has some special characters , the file is emailing as attachment. But i need the file as the body in the email if it has special... (1 Reply)
Discussion started by: nani1984
1 Replies

2. Shell Programming and Scripting

Not able to send attachment with the email

Hi All, The below code is working fine for me. mailx -s hello abc@xyz.com <<EOT Hello !!! How are you? Regards Rahul EOT But i am not able to send csv file with the mail .Getting just themail but not the attachment. uuencode /path/s1.csv | mailx -s hello abc@xyz.com <<EOT... (9 Replies)
Discussion started by: rafa_fed2
9 Replies

3. UNIX for Advanced & Expert Users

email file as attachment...

Hello all, i am on hp-ux 11.23...i am trying to send an email as an attachement but it dose not seem to work...after reading on google i found that we can use uuencode to send file at attachement...here is my file and the syntax $ cat test.txt NAME --------- TEST $ uuencode... (7 Replies)
Discussion started by: abdul.irfan2
7 Replies

4. Shell Programming and Scripting

sending an email with attachment

Hi, Please help me in sending an e-mail with attachment through unix mailx command is not present in our unix box. (4 Replies)
Discussion started by: dudd9
4 Replies

5. UNIX for Dummies Questions & Answers

An empty attachment coming with the name of subject

Hi All, I am sending a mail with attachment only in this way. But each time with attachment comes another attachment with the name of "Testing.txt" which is just an empty text file how to remove this thing please help (uuencode ./file2.txt "Bad file")|mailx -s "Testing" maindola@rediff.com ... (7 Replies)
Discussion started by: maindola.amit
7 Replies

6. Shell Programming and Scripting

Sending Email with Attachment

Hi, I want to send an email with multiple attachment using uuencode and mail command. I am able to send with one attachment Ex:uuencode abc.txt abc.txt | mail test@test.com -s "Test3" Can anyone reply with syntax. Regards BS (3 Replies)
Discussion started by: balajiora
3 Replies

7. AIX

Email with Attachment

Hi, I have .ksh file which internally calls a .sql file. This sql file writes a file with the result. I am using the following command to send email with the result file as attachment uuencode file.txt file.txt | mail -s "Subject" abc@abc.com. When i run the .ksh file i get a message you... (5 Replies)
Discussion started by: piyushprabhakar
5 Replies

8. UNIX for Dummies Questions & Answers

how to deattach attachment of email

how to deattach attachment of email (4 Replies)
Discussion started by: kandati
4 Replies

9. UNIX for Dummies Questions & Answers

Email Attachment

Is there a way to send an email attachment? So far no where I've looked has given me any leads. (2 Replies)
Discussion started by: Cyro
2 Replies

10. UNIX for Dummies Questions & Answers

Email Attachment

Hi, I have 2 questions regarding sending mail as attachment. 1. Using mime type (From Oracle tools which reside on UNIX) When send the mail(txt file) as an attachment, on some servers like Hotmail, the email goes perfect as an attachment. But on some servers like yahoo, get embedded mail which... (2 Replies)
Discussion started by: prasad01
2 Replies
Login or Register to Ask a Question