The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Unreadable SanjayLinux Shell Programming and Scripting 3 09-25-2007 03:52 AM
Unreadable Unix File ryangfm UNIX for Dummies Questions & Answers 19 02-09-2007 10:18 AM
not able to run base64 exe lotus123 UNIX for Dummies Questions & Answers 0 08-24-2005 03:07 PM
I'm looking for someone who have Base64 binary Bruno_LAMOUR UNIX for Dummies Questions & Answers 3 02-03-2005 09:19 AM
gunzip and base64 decode a string handak9 High Level Programming 2 10-23-2004 06:05 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-29-2008
Registered User
 

Join Date: Jan 2008
Posts: 2
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**"):

> 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!
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 01-30-2008
Registered User
 

Join Date: Jan 2008
Posts: 2
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.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:04 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0