Android Question How can I retrieve message from pop3 server?

Beja

Expert
Licensed User
Longtime User
Hi all,
In the example:
m = MailParser.ParseMail(MessageText, File.DirRootExternal)
Log(m)
Then I added:
EditText1.Text=MessageText
This will show the raw message including all headers.. but I want only the body of the message.. e.g.
msg subject = test
msg body = This is a test.
So I want to put "This is a test" in edittext1

thanks in advance
 

Beja

Expert
Licensed User
Longtime User
Hi Erel,
Trying the example of I used m.body, the result was an html code with no body.
pls see the screenshot of the emulator.. the real device is the same.. the actual log file is larger html code.
 

Attachments

  • logfile.jpg
    logfile.jpg
    67.6 KB · Views: 231
Upvote 0

sorex

Expert
Licensed User
Longtime User
I guess it depends on the client that sends the mail.

You can have plain text (7bit ascii), html mails, multi-part mail and combinations of plain text, a html copy and a base64 encode copy or attachment.

you schould read the RFC to support all variations.
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
hello sorex and thanks for the info..
But I thought the library will shield me from going down the documentation outside B4A. So you mean the example can not work?
Now I changed the sending email server to also gmail, and I got a shorter html code engulfing my message "bbbbbbbb"

<div dir="ltr">bbbbbbbb</div>

I can easily parse this and retrieve just the message (bbbbbbbb).. but still this is not a solution I think.
Again, now the sender and receiver are both gmail, so there should not be any problem, but the problem is still there
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
I never used a pop3 library in b4a so I don't know how it parses the body.

if formatting is not a problem why not just send as plain text?
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
if formatting is not a problem why not just send as plain text?
This is the problem.. I am not sending formatted text.. just plain text but receiving the formatting tags.
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
Your mail client is responsible for this html.
Yes Erel, you are right..
I was trying to reproduce the error all this time without success, but now when I returned to Hotmail and sent the message from there
it came back.. so the culprit was Hotmail client, it sent some garbage along with the message.. when I sent the same text from gmail client
there was no problem.

Thanks again.
 
Upvote 0
Top