B4X:
Private Sub btnSendEmail_Click
Wait For (FileHandler1.Load("*/*", "Choose file")) Complete (Result1 As LoadResult)
If Result1.Success Then
Private fDir, fName As String
fName = Result1.FileName
fDir = Result1.Dir
SMTP1.To.Add("example@gmail.com")
SMTP1.Subject = SSSSS"
SMTP1.Body = "bbbbb"
SMTP1.AddAttachment(fDir, fName)
SMTP1.Send
End If
Sub SMTP1_MessageSent(Success As Boolean)
Log(Success)
If Success Then
ToastMessageShow("Message sent successfully", True)
Else
ToastMessageShow("Error sending message", True)
Log(LastException.Message)
End If
End Sub
It sends fine, but in the incoming mail the attachment has a path in the name:
content___com.android.externalstorage.documents_document_primary%3ADownload%2Ftest.txt
MessageSend returns false if fName = Result1.RealName is used.
How to make it just only the filename?