Bug? Mail Parser: last attached file isn't extracted from message

b4auser1

Well-Known Member
Licensed User
Longtime User
Please correct Sub ParseMultipartBody and add the code line marked with comment ' !!! in order to download the attached file (last BodyPart), which doesn't have "--" after it, but the end of message string instead.

B4X:
Sub ParseMultipartBody (Mail As String, Msg As Message)
…           
            nextPart = Mail.IndexOf2("--" & boundary, index)
           
            If nextPart = -1 Then nextPart = Mail.Length ' !!!
           
            If nextPart-4 > index Then
                HandlePart(headers.ToString, Mail.SubString2(index, nextPart-4), Msg)
            End If
…
End Sub
 
Top