B4J Question Mailparser for B4J

wl

Well-Known Member
Licensed User
Longtime User
Is there something like B4A's mailparsers that can be fed by a raw mail message and that parses this content: sender, to, subject, body, attachments, ... ?

Tx
 

wl

Well-Known Member
Licensed User
Longtime User
That's working, but it seems HTML emails still contain =3D, =20 coding. Is there any simple way to have this removed ?

Tx
 
Upvote 0

wl

Well-Known Member
Licensed User
Longtime User
Tx. I have a HTML email message and when it gets through the MailParser it returns an empty body ? Is this normal ?

Tx
 
Upvote 0

wl

Well-Known Member
Licensed User
Longtime User
The problem is caused by multipart/alternative sections.

In that case the Content-type header contains the boundary name of the multipart section.

The code does not take into account that the multipart-section contains its own boundary for it subparts (that may or may not be different).


See example below:

B4X:
Content-Type: multipart/related;
    boundary="Message-Boundary-by-Mail-Sender-1467064509"
Return-Path: [email protected]
X-OriginalArrivalTime: 27 Jun 2016 21:55:11.0332 (UTC) FILETIME=[93D97240:01D1D0BE]

--Message-Boundary-by-Mail-Sender-1467064509
Content-Type: multipart/alternative;
    boundary="Part-Message-Boundary-by-Mail-Sender-1467064509_2"

--Part-Message-Boundary-by-Mail-Sender-1467064509_2
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

In the example below the boundary is set to: Message-Boundary-by-Mail-Sender-1467064509
The multipart/alternative matches this boundary and then this is the only part being dealt with (reads to the end of the mail that closes this boundary).

What should be done is:
- in case of a multipart/alternative the new boundary is to be set (
Part-Message-Boundary-by-Mail-Sender-1467064509_2)
- with this new boundary the parts below should be parsed.

This seem correct as the code it dealing with this in a correct way ?

Tx
 
Last edited:
Upvote 0

wl

Well-Known Member
Licensed User
Longtime User
I guess it is not that difficult to support it. I modified the code so it handles multipart/alternative.
 
Upvote 0

wl

Well-Known Member
Licensed User
Longtime User
Did you end up uploading it ?

Unfortunately not. I did not check it in and lost it :-( was in a temp folder.

modification was simple I recall...

Unfortunately I am currently not at home so I can't rewrite it for the next 2 weeks...
 
Upvote 0
Top