Dim m As Message
Dim body, subject As String
m = MailParser.ParseMail(MessageText, File.DirRootExternal) ' La vostra linea di codice
subject=m.Subject
body=m.Body
body=DecodeQuotePrintable(body) ' Lo converte nel codice HTML
Log(subject)
Log(body)
' -----------------------------------------------------------------
Sub DecodeQuotePrintable(q As String) As String
Dim bytes As List
bytes.Initialize
Dim i As Int
Do While i < q.Length
Dim c As String
c = q.CharAt(i)
If c = "_" Then
bytes.AddAll(" ".GetBytes("utf8"))
Else If c = "=" And i < q.Length - 1 Then
Dim hex As String
hex = q.CharAt(i + 1) & q.CharAt(i + 2)
i = i + 2
Try
bytes.Add(Bit.ParseInt(hex, 16))
Catch
bytes.AddAll(hex.GetBytes("utf8"))
End Try
Else
bytes.AddAll(c.GetBytes("utf8"))
End If
i = i + 1
Loop
Dim b(bytes.Size) As Byte
For i = 0 To bytes.Size - 1
b(i) = bytes.Get(i)
Next
Return BytesToString(b, 0, b.Length, "utf8")
End Sub