W wl Well-Known Member Licensed User Longtime User Jun 25, 2016 #1 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
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
Erel B4X founder Staff member Licensed User Longtime User Jun 26, 2016 #2 You can use B4A MailParser in B4J or B4i. Upvote 0
W wl Well-Known Member Licensed User Longtime User Jun 26, 2016 #3 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
That's working, but it seems HTML emails still contain =3D, =20 coding. Is there any simple way to have this removed ? Tx
Erel B4X founder Staff member Licensed User Longtime User Jun 27, 2016 #4 See this thread: https://www.b4x.com/android/forum/threads/using-pop3-and-mailparser.66978/#post-424185 Upvote 0
See this thread: https://www.b4x.com/android/forum/threads/using-pop3-and-mailparser.66978/#post-424185
W wl Well-Known Member Licensed User Longtime User Jun 27, 2016 #5 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
Tx. I have a HTML email message and when it gets through the MailParser it returns an empty body ? Is this normal ? Tx
Erel B4X founder Staff member Licensed User Longtime User Jun 28, 2016 #6 Put a breakpoint in MailParser and see what happens during the parsing. Upvote 0
W wl Well-Known Member Licensed User Longtime User Jun 28, 2016 #7 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: Code: Copy 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: Jun 28, 2016 Upvote 0
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: Code: Copy 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
Erel B4X founder Staff member Licensed User Longtime User Jun 29, 2016 #8 MailParser doesn't support all the possible mail formats, specifically it doesn't support multipart/alternative. Upvote 0
MailParser doesn't support all the possible mail formats, specifically it doesn't support multipart/alternative.
W wl Well-Known Member Licensed User Longtime User Jun 30, 2016 #9 I guess it is not that difficult to support it. I modified the code so it handles multipart/alternative. Upvote 0
I guess it is not that difficult to support it. I modified the code so it handles multipart/alternative.
Erel B4X founder Staff member Licensed User Longtime User Jul 3, 2016 #10 It is worth uploading it... Upvote 0
mr23 Active Member Licensed User Longtime User Jul 17, 2016 #11 wl said: I guess it is not that difficult to support it. I modified the code so it handles multipart/alternative. Click to expand... Did you end up uploading it ? Upvote 0
wl said: I guess it is not that difficult to support it. I modified the code so it handles multipart/alternative. Click to expand... Did you end up uploading it ?
W wl Well-Known Member Licensed User Longtime User Jul 17, 2016 #12 mr23 said: Did you end up uploading it ? Click to expand... 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
mr23 said: Did you end up uploading it ? Click to expand... 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...