Public Sub HandlePart(Headers As String, Body As String, Msg As Message)
Try
If Regex.Matcher2("Content-Transfer-Encoding:\s*base64", _
Regex.CASE_INSENSITIVE, Headers).Find Then
............................
............................
Dim su As StringUtils
Dim out As OutputStream
'save attachment right here
out = File.OpenOutput(dir, filename, False)
Dim data() As Byte
data = su.DecodeBase64(Body)
Log("file saved: " & filename & " (" & data.Length & " bytes)")
out.WriteBytes(data, 0, data.Length)
out.Close
Msg.Attachments.Add(filename)
Else If Regex.Matcher2("Content-Type:\s*text/", _
Regex.CASE_INSENSITIVE, Headers).Find Then
Msg.Body = Body
End If