> On Friday, August 14, 2015 at 11:20:08 AM UTC-7, Richard wrote: >> >> > 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 the 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 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.] >> >> >> > >> > Date: Friday, August 14, 2015 10:45:23 -0700 >> > From: [email protected] <javascript:> >> > >> > 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. >> >> The content-type is set when the message is generated - based on >> the types/parts in the message. By the time the message is on >> the imap/pop server that K-9, (or some other email client), is >> pulling from there's nothing you can do -- except to use that as >> the informational tag that it is intended as. >> >> My suggestion for setting K-9 (or some other mail client) to send >> plain text is so that you can send a plain-text-only (non-html) >> message to your inbox and see how it looks when you pull the >> stream compared to the html-only one that you picked up earlier >> -- mostly to prove that K-9 isn't doing the html markup on the >> way in. >> >> In short, what the (raw) message body looks like - html, plain >> text, base64 encoded, etc., is totally beyond the control of the >> client reading the message. The role of the reading client is to >> be able to parse the message body (based on the body-part >> tagging) and display/render the results correctly. So, if your >> goal is to be able to set up "specialized storage in order to >> use an odd email format" you'll need to be able to handle >> anything that comes along. In this day and age, the vast >> majority of messages will be at least partially html (i.e., >> multi-part - plain-text and html), with many being html-only. >> >> You really need to do reading on message body structure and types >> so that you will have an understanding of the types of things >> you need to be able to handle. >> >> > > Date: Friday, August 14, 2015 11:53:12 -0700 > From: [email protected] > > Right so thats what I want to do. I want to find out what methods > in K9 are related to "The role of the reading client is to be > able to parse the message body (based on the body-part tagging)" > Or does K9 not do that? >
But if the message is html-only (like the message you dumped here earlier) that's what/all you are going to see. I.e., you won't magically be able to get "clean text" output from an html part. What an email client does with an html part is simply pass it to an html rendering engine - if you look at the raw message/page source you'll still see the html. If that's a problem for you with what you are trying to do you'll need to think about other approaches. Good luck. -- -- 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.
