Bug? Problem sending Attachments on marshmallow

Tommaso

Member
Licensed User
Longtime User
Hi all,
I've a problem sending email with attachments on marshmallow device (Nexus 5x)
Gmail Appear fine but prompt this error "impossibile allegare un file vuoto" - Unable to attach empty file (i've check Attached file, exist and isn't empty)

application works fine on android 5.x device but doesn't work on 6.x

B4X:
'Sul click della label Info Mando la mail con l'UDID per l'attivazione
    Dim mailapp As Email
    mailapp.Subject = "Contatto da Android"

    Dim Codice As String = CreaEmail
    'Imposto il testo della mail
    mailapp.Body = "In allegato il contatto"
    mailapp.To.Add("support@palmosoft.com")
   
    'Allego l'attivazione
    File.WriteString(File.DirRootExternal, Codice & ".txt", Codice)
   
    Dim list1 As List
    list1 = File.ReadList(File.DirRootExternal, Codice & ".txt")
    For x = 0 To list1.Size - 1
        Log(list1.Get(x))
    Next
   
    mailapp.Attachments.Add(File.DirRootExternal & "/" & Codice & ".txt")
    'Mando la mela
    StartActivity(mailapp.GetIntent)

Thanks in advance for support
regards
Tommaso
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I've tried it with this code and it works fine:

B4X:
Sub Activity_Click
   Dim e As Email
   File.WriteString(File.DirRootExternal, "1.txt", "abc")
   e.Attachments.Add(File.Combine(File.DirRootExternal, "1.txt"))
   StartActivity(e.GetIntent)
End Sub


upload_2016-1-14_14-27-15.png
 

Tommaso

Member
Licensed User
Longtime User
I've tried it with this code and it works fine:

B4X:
Sub Activity_Click
   Dim e As Email
   File.WriteString(File.DirRootExternal, "1.txt", "abc")
   e.Attachments.Add(File.Combine(File.DirRootExternal, "1.txt"))
   StartActivity(e.GetIntent)
End Sub


View attachment 40588
Hi Erel
I've try your sample code but I've the same result
"impossibile allegare un file vuoto" - Unable to attach empty file

Screenshot_20160114-145251.png

I've this problem on Lg Nexus 5X (Android 6.0.1). It works fine on other device.

Maybe I miss something (any permission on Manifest??)
Any idea may be appreciated

Thanks
Tommaso
 

Tommaso

Member
Licensed User
Longtime User
I've tested it on Nexus 5 running Android 6.0.1. What did you set the targetSdkVersion to?

Hi Erel,
It's a permission problem on email client, I've found that on Gmail Application - Autorization there are some flag,
Enabling Archiviazione - Storage it works fine
Screenshot_20160114-152042.png Screenshot_20160114-152048.png

Thanks for support
Regards
Tommaso
 
Top