sending .aif audio file via email popup as attachment failure

hi, I am positive I had this working before upgrading to the most recent version of the SDK. I am recording an audio file in the background for my app, PracticeBuddy, and sending a sample of that (to keep flle size down) as an email attachment. 

[lua]local onEmailRequestEvent = function( event )
if event.phase == “ended” then
local options =
{
to = emailAddress,
subject = “My Practice Session!”,
body = “Attached is a recording of the practice session I just completed.”,
attachment = { baseDir=system.DocumentsDirectory,
filename=dataFileName, type=“audio” },
}
native.showPopup(“mail”, options)
end
end

[/lua]

Bizarrely, the attachment shows up in the popup, but then it doesn’t make it after being sent into the inbox. The attachment is just not … attached. 

I tested sending a .png from system.ResourcesDirectory and was successful. Does anyone have experience sending .aifs as attachments?

thanks,

Jen

Geez, dumb mistake. FYI, don’t include the full path in the variable ‘fileToSend’, just the name of the file. The path is taken care of via baseDir. There is a limit on file size, however, that you can send over email, I think it’s 20 mgs, so that’s a limitation that will cause the same effect, fyi.

:slight_smile:
Jen

Geez, dumb mistake. FYI, don’t include the full path in the variable ‘fileToSend’, just the name of the file. The path is taken care of via baseDir. There is a limit on file size, however, that you can send over email, I think it’s 20 mgs, so that’s a limitation that will cause the same effect, fyi.

:slight_smile:
Jen

hi Jen, do you know why this doesn’t work:

function label:tap(e)

    native.showPopup(“mail”, {

        to = “”, 

        subject = “”,

        body = “”,

        

        attachment = {

            baseDir = system.DocumentsDirectory,

            filename=“data.txt”,

            type=“text”        

        }

    });

end

label:addEventListener(“tap”,label);

end

The data.txt file shows up in the pop up as your audio file did, but the file doesn’t attach. Is it the mime type?

p.s., I’ve also tried:

type=“text/plain”

as the mime type with no success…

hi, sorry for the late reply, I was out of town. Your code doesn’t look incorrect; can you try to send an image with mimetype “image” to make sure that the rest of the code is working? I’d also just make sure of the size of your attachment file. Try sending something very small and then go up from there.

hi Jen, do you know why this doesn’t work:

function label:tap(e)

    native.showPopup(“mail”, {

        to = “”, 

        subject = “”,

        body = “”,

        

        attachment = {

            baseDir = system.DocumentsDirectory,

            filename=“data.txt”,

            type=“text”        

        }

    });

end

label:addEventListener(“tap”,label);

end

The data.txt file shows up in the pop up as your audio file did, but the file doesn’t attach. Is it the mime type?

p.s., I’ve also tried:

type=“text/plain”

as the mime type with no success…

hi, sorry for the late reply, I was out of town. Your code doesn’t look incorrect; can you try to send an image with mimetype “image” to make sure that the rest of the code is working? I’d also just make sure of the size of your attachment file. Try sending something very small and then go up from there.