mailx saved messages are unreadable (base64)


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers mailx saved messages are unreadable (base64)
# 1  
Old 01-29-2008
mailx saved messages are unreadable (base64)

I am trying to parse emails sent from a blackberry. I am using fetchmail to download email through IMAP from my exchange server and then forward to local Linux mail. (This part works fine.)

When viewing and saving messages sent as plain text from Outlook, everything works fine. However, when viewing messages sent from a Blackberry the message body displays correctly but when saved to a file it's unreadable (the message body is encoded in base64.)

How can I get mailx to save a readable version of the email?

Here's what I mean (identifiable information removed, the message body should display as "**Message_body**"):

Code:
> mailx
Heirloom mailx version 12.3 7/15/07.  Type ? for help.
"/var/spool/mail/user": 1 message 1 new
>N  1 Sender, Sender   Tue Jan 29 14:30   49/2051  Subject_field
? 1
Message  1:
From email@address.com  Tue Jan 29 14:30:05 2008
Return-Path: <email@address.com>
Content-Type: multipart/alternative;
        boundary="----_=_NextPart_001_01C862AD.54FC8BB2"
Content-class: urn:content-classes:message
X-MimeOLE: Produced By Microsoft Exchange V6.5
Subject: Subject_field
Date: Tue, 29 Jan 2008 14:29:47 -0500
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
Thread-Topic: Subject_field
Thread-Index: AchirU+hlJwW1AP9RfOQWEbc6R6uBA==
From: "Sender, Sender" <email@address.com>
To: "Receiver, Receiver" <email@address.com>
Status: R

Content-Type: text/plain;
        charset="utf-8"

**Message_body**
? s1 file.out
"file.out" [New file] 51/2072
? q
> cat file.out
From email@address.com  Tue Jan 29 14:30:05 2008
Return-Path: <email@address.com>
Received: from *server_name* (localhost.localdomain [127.0.0.1])
        by *server_name* (8.13.1/8.13.1) with ESMTP id m0TJU5En008696
        for <user@localhost>; Tue, 29 Jan 2008 14:30:05 -0500
Received: from *exchange_server* [172.16.193.21]
        by *server_name* with IMAP (fetchmail-6.3.8)
        for <user@localhost> (single-drop); Tue, 29 Jan 2008 14:30:05 -0500 (EST)
Received: by *exchange_server*
        id <01C862AD.54FC8BB2@exchange_server>; Tue, 29 Jan 2008 14:29:57 -0500
MIME-Version: 1.0
Content-Type: multipart/alternative;
        boundary="----_=_NextPart_001_01C862AD.54FC8BB2"
Content-class: urn:content-classes:message
X-MimeOLE: Produced By Microsoft Exchange V6.5
Subject: Subject_field
Date: Tue, 29 Jan 2008 14:29:47 -0500
Message-ID: <69F942F3D7516A469039D624B20442970B60A0DD@*exchange_server*>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
Thread-Topic: Subject_field
Thread-Index: AchirU+hlJwW1AP9RfOQWEbc6R6uBA==
From: "Sender, Sender" <email@address.com>
To: "Receiver, Receiver" <email@address.com>
Status: R

This is a multi-part message in MIME format.

------_=_NextPart_001_01C862AD.54FC8BB2
Content-Type: text/plain;
        charset="utf-8"
Content-Transfer-Encoding: base64

TWVzc2FnZV9ib2R5DQo=

------_=_NextPart_001_01C862AD.54FC8BB2
Content-Type: text/html;
        charset="utf-8"
Content-Transfer-Encoding: base64

PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDMuMi8vRU4iPg0KPEhUTUw+
DQo8SEVBRD4NCjxNRVRBIEhUVFAtRVFVSVY9IkNvbnRlbnQtVHlwZSIgQ09OVEVOVD0idGV4dC9o
dG1sOyBjaGFyc2V0PXV0Zi04Ij4NCjxNRVRBIE5BTUU9IkdlbmVyYXRvciIgQ09OVEVOVD0iTVMg
RXhjaGFuZ2UgU2VydmVyNpb24gNi41Ljc2NTIuMjQiPg0KPFRJVExFPlN1YmplY3RfZmll
bGQ8L1RJVExFPg0KPC9IRUFEPg0KPEJPRFk+DQo8IS0tIENvbnZlcnRlZCBmcm9tIHRleHQvcGxh
aW4gZm9ybWF0IC0tPg0KDQo8UD48Rk9OVCBTSVpFPTI+TWVzc2FnZV9ib2R5PC9GT05UPg0KPC9Q
Pg0KDQo8L0JPRFk+DQo8L0hUTUw+

------_=_NextPart_001_01C862AD.54FC8BB2--


>

Thanks for your help!
# 2  
Old 01-30-2008
Followup Answer

Turns out mailx isn't as intelligent as I thought. The save command simply copies the message from /var/spool/mail/user to the file specified, no decoding is performed. I had previously thought the save command saved mail in a plain text format that could be viewed externally...

I solved my problem by using:


Code:
mailx > ~/.mail_reader <<EOF
1
d1
quit
EOF

instead of:
Code:
mailx <<EOF
s1 ~/.mail_reader
quit
EOF

and performed a little more text manipulation to remove the mailx login/listing stuff at the top of the file...

Hope this helps someone else someday.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Why are there LFs in my base64?

And is there a good way of taking them out? I've been playing around a bit with using b64 to embed images in HTML (and trying to stay within the spec). I've noticed that with openssl's base64 encoder, the output files have newline characters @ every 65th column or so. This renders them useless,... (2 Replies)
Discussion started by: SilversleevesX
2 Replies

2. UNIX for Dummies Questions & Answers

Files unreadable in unix, help needed.

Hi, I developed a java application in Windows and transferred it to a HP-UX environment(using WinSCP) for deployment. I used "chmod 777 ..." for granting rights to the files. After I did this, whenever I go into that directory(or it's immediate parent directory) and hit "ls"......it... (4 Replies)
Discussion started by: agnivaccent
4 Replies

3. UNIX for Dummies Questions & Answers

mailx and html body messages

Hi, I'm working on Solaris 9 (SPARC) and I like to send an html body message to our users when something happen. The problem is that I can't find how to give mime type information with mailx. To be recognized as html I need to put in email header this information: Mime-Version: 1.0... (2 Replies)
Discussion started by: gbagagli
2 Replies

4. UNIX for Advanced & Expert Users

unreadable

Hi, can someone explain what does this mean and why does this happen? i had this problem last week, and Unix admin said that he has to rebuild the file system. Now i am getting this error again. aaaa% ls . unreadable :mad: (7 Replies)
Discussion started by: treneryy
7 Replies

5. Red Hat

pstree unreadable characters

hi all, i executed this command "pstree" on redhat ent 4 and i got this below with unreadable chars: init─┬─acpid ─amqzxma0─┬─amqrrmfa │ ─amqzdmaa │ ─amqzfuma │ ─5* │ ─amqzmgr0─┬─amqpcsea │ │ ... (2 Replies)
Discussion started by: itik
2 Replies

6. Shell Programming and Scripting

Unreadable

Hi Guys, I have one query. Say I have one script named test.sh. My Question: There is any method by which I can make this script (test.sh) non-human readable( like Encrypt) format as well as it should be executable also(mean to say it (test.sh) should not change its behaviour). Thanks... (3 Replies)
Discussion started by: SanjayLinux
3 Replies

7. UNIX for Dummies Questions & Answers

Unreadable Unix File

Hi Everyone, I have a question for you all. I am working at a company and we are trying to recover .dat files which were created on an older linux box and we have a folder of .dat files that are unreadable. When you try to open them in a text editor you get jibberish all shapes and sizes and... (19 Replies)
Discussion started by: ryangfm
19 Replies

8. UNIX for Dummies Questions & Answers

not able to run base64 exe

Hi, I have copied base64.exe under base64-1.3 folder and i am trying to run base64.exe from another folder called Request. But i am getting the following error message. mga.ksh: base64: not found Please let me know how to execute the base64.exe from a directory where it is not installed. ... (0 Replies)
Discussion started by: lotus123
0 Replies

9. UNIX for Dummies Questions & Answers

I'm looking for someone who have Base64 binary

I need to install the base64 encryption method on a UNIX machine under AIX5.2. I've received a tar file but it is only C source , can you help me please. (sending me a binary base64 or to compile my source) Thanks by advance (3 Replies)
Discussion started by: Bruno_LAMOUR
3 Replies
Login or Register to Ask a Question