Emailing Attachments on Marshmallow

I have an app that will attach a PDF and send it using the email app the user chooses. This seems to work fine on anything, but Marshmallow. When I try this on Marshmallow I get varied results. In Gmail, I get a toast saying "Can't attach empty file" and in Outlook for Android it attaches a file and adds the .eml extension. I have tried the same published code on Marshmallow and Lollipop. Lollipop works fine and Marshmallow (Nexus 6) does not.

Any ideas?

Answers

  • CheesebaronCheesebaron DKInsider, University mod

    What code have you tried?

  • TheGX2TheGX2 USMember

    var email = new Intent (Intent.ActionSend);
    email.PutExtra(Intent.ExtraEmail, new string[]{Recipient.EmailAddress});
    var file = new Java.IO.File (PDFFile);
    file.SetReadable (true,false);

            var uri = Uri.FromFile (file);
            email.PutExtra (Intent.ExtraCc,new string[]{CurrentOwner.Email} );
            email.PutExtra(Intent.ExtraStream, uri);
            email.PutExtra (Intent.ExtraSubject, "Quote for Lumbering...");
            email.PutExtra(Intent.ExtraText, "TEXT FOR MESSAGE");
            email.SetType ("message/rfc822");
    
            Forms.Context.StartActivity(Intent.CreateChooser(email, "Send mail..."));
    
  • csampaio01csampaio01 PTMember ✭✭✭

    Did you solved it?

Sign In or Register to comment.