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:
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
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.
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
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.
Mail clients are bad at handling uuencoded attachments these days. Some don't understand them at all, some mangle them. Best to use base64 attachments if you can, but I don't know of any way that was as straightforward as uuencode was.
mail is a bit picky about char sets and what it considers binary data. Pls post text_file.txt and the result of both unix2dos and uuencode. For a pure text file, you usually don't need uuencode. Btw, the file is not an attachment but will be the mail text itself.
You can also try to display the source code of the message (<ctrl> u in thunderbird) to help debug the problem.
I sftp to the unix box and I got the text and zip files and I'm able to see them both on my PC. Why I can't see it when I email it. BTW I'm not an expert in unix.
Received: from FLDP1LUMXC7HB02.domain.com (168.68.75.85) by
MXC7HB05.domain.com (168.68.59.192) with Microsoft SMTP Server
(TLS) id 8.3.264.0; Wed, 15 Aug 2012 13:31:38 -0400
Content-Type: multipart/mixed;
boundary="_8ba3ac-2ef3-4d69-84eb-0f92a29d51a5_"
Received: from omzsmtpi03.domain.com (165.122.46.173) by
MXC7HB02.domain.com (168.68.75.85) with Microsoft SMTP Server
id 8.3.264.0; Wed, 15 Aug 2012 13:31:36 -0400
To: name@domain.com
X-VzAPP: 1
X-IronPort-AV: E=Sophos;i="4.77,774,1336348800";
d="scan'208";a="85187077"
X-Local: true
Received: from ndcc01-smtp1.domain.com ([148.170.124.35]) by
omzsmtpi03.domain.com with ESMTP; 15 Aug 2012 17:31:35 +0000
Received: from pdcd35-snmcpe1.ip.mic.com (pdcd35-snmcpe1.ip.mic.com
[208.112.196.84]) by ndcc01-smtp1.domain.com
(8.13.8+Sun/8.13.8/vz-mnso-$Revision: 1.5 $) with ESMTP id q7HVZh0010433 for
<name@one.domain.com>; Wed, 15 Aug 2012 17:31:35 GMT
Received: from pdcd35-snmcpe1.ip.mic.com (localhost [127.0.0.1]) by
pdcd35-snmcpe1.ip.mic.com (8.13.8+Sun/8.14.2) with ESMTP id q7HVJtD024085
for <name@one.domain.com>; Wed, 15 Aug 2012 17:31:19 GMT
Received: (from myname@localhost) by pdcd35-snmcpe1.ip.mic.com
(8.13.8+Sun/8.14.2/Submit) id q7FHVJbp024084 for
name@one.domain.com; Wed, 15 Aug 2012 17:31:19 GMT
Date: Wed, 15 Aug 2012 17:31:19 +0000
From: david.foo <myname@pdcd35-snmcpe1.ip.mic.com>
Message-ID: <201208151731.q7FHVJbp024084@pdcd35-snmcpe1.ip.mic.com>
Subject: Hi
MIME-Version: 1.0
Return-Path: myname@pdcd35-snmcpe1.ip.mic.com
X-ConvertedToMime: 1
The same problem i am facing.
I am sending file with csv extension.
However, I am receiving mail with empty file.
Before sending file was containing data.
Any suggestions please...
Thanks.