You keep referring to content-type. Is that a variable that can be set by me? Also the setting the account to plain text does not work since this is the inbox so that means that I am viewing the text body not sending it.
On Friday, August 14, 2015 at 10:25:19 AM UTC-7, Richard wrote: > > > > On Thursday, August 13, 2015 at 4:08:28 PM UTC-7, Richard wrote: > >> > >> > Date: Thursday, August 13, 2015 15:03:35 -0700 > >> > From: [email protected] > >> > > >> > I am trying to create a fork of K9 that implements a > >> > specialized storage in order to use an odd email format. I > >> > have the body of an email message as a string but it appears > >> > to be encoded in HTML. Right now I am using the TextBody > >> > class but what can I do so that it decodes this message and > >> > displays it in a nice pretty format rather than this mess of > >> > <html xmlns:> tags? > >> > >> Is message you are looking at single-part - text-only, > >> single-part - html-only or multi-part? I believe that if it's > >> single-part text-only ("Content-Type: text/plain") that K-9 > >> leaves it that way. If it's multi-part, K-9 appears to only show > >> the html part. Obviously if it's single-part html-only, > >> (Content-Type: text/html) then K-9 only has the html. > >> > >> I'm fairly certain that the message body (html encoded or > >> otherwise) that you are seeing is the way that it's being pulled > >> from the imap/pop server -- i.e., the way it was generated by > >> the originating mail client/program, not an encoding that K-9 is > >> doing. All most email clients (most likely K-9 included) do is > >> render what they retrieve. > >> > >> If you are pulling multi-part (Content-Type: > >> multipart/alternative;) you may be able to get the text part, > >> which K-9 doesn't display, which should be clean text (though > >> some originating mail clients/programs will put html markup in > >> what they claim is a text/plain message body part). > >> > > > Date: Friday, August 14, 2015 09:49:35 -0700 > > From: [email protected] <javascript:> > > > > I have no clue if this is any help but here is the raw string. It > > matches the body shown by K9 > > > > <html xmlns:v="urn:schemas-microsoft-com:vml" > > xmlns:o="urn:schemas-microsoft-com:office:office" > > xmlns:w="urn:schemas-microsoft-com:office:word" > > xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" > > xmlns="http://www.w3.org/TR/REC-html40"><head><meta > > http-equiv="Content-Type" content="text/html; charset=utf-8"> > > name="Generator" content="Microsoft Word 15 > > ... snip > > > > With the output that you are showing it appears that you have an > html-only (Content-Type" content="text/html;) message body, > generated by some MS mail client (that's using MSWord). K-9 didn't > do that markup, it came that way off imap/pop mail server. All K-9 > will/can do in this instance is render the html. [note -- MS's html > generators tend to create particularly messy html.] > > Try creating a text-only message - most mail clients have the > ability to generate non-html messages. In K-9 look at: > > [account] settings > - Sending mail > - Message Format > - select the "Plain Text" button > > and you'll see the difference in the message body that you capture. > > If you want "clear text" message bodies you'll have to be prepared > to de-html-ize html-only messages with some code that you > write/acquire. > > As I indicated earlier, there are three basic types of message > bodies: > > - text-only > - html-only > - multi-part -- text and html > > With the first and last you should be able to capture the text parts > (though K-9 doesn't display the text part on multi-part messages so > you may have to do some work to capture that part). With the middle > type you'll have to clean it up if you don't want the html. > > Note, there are other types of message body parts -- including > base64 encoded and attachments. > > You may want to do some reading about about message structure to get > a better understanding of what might come your way. > > [please maintain the response direction flow when responding to a > message. i.e., do not top-post a response to this message.] > > > -- -- You received this message because you are subscribed to the K-9 Mail Users List. To post to this group, send email to [email protected] To unsubscribe, email [email protected] To report an issue with K-9 Mail, visit http://code.google.com/p/k9mail/issues/list For more options, visit this group at http://groups.google.com/group/k-9-mail --- You received this message because you are subscribed to the Google Groups "K-9 Mail" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
