I’ve been racking my brains for hours on this and I think I’m missing something obvious. I can’t see how to send multiple attachments programatically ?
I thought that I could do it by creating a string containing the attachment data, formatted to create a table, see below:
The key part being the ‘attachment = _G.documentsString’. I was hoping this would evaluate the contents of the string and create an appropriate table as needed by the attachment option.
Also, sample app “Networking/ComposeEmailSMS” attaches 2 files to the e-mail as well.
The one issue I see in your code is that you are trying to attach a “testtest.lua” file, which does not exist in your resource directory after building for iOS or Android because Corona compiles all Lua scripts to byte code and combines them into a single binary file within your app.
Also, sample app “Networking/ComposeEmailSMS” attaches 2 files to the e-mail as well.
The one issue I see in your code is that you are trying to attach a “testtest.lua” file, which does not exist in your resource directory after building for iOS or Android because Corona compiles all Lua scripts to byte code and combines them into a single binary file within your app.
I’m attempting to do the same thing, but can’t get this to work.
I’m sure this is due to some lack of knowledge about lua tables and strings, but I can’t figure this out.
(1) If I hardcode “attachment = { baseDir=system.DocumentsDirectory, filename=‘mtnphoto1.jpg’, type=‘image/jpg’ },” everything works fine. The generated email includes the attachment.
(2) However, I want to do this programmatically since there may be zero, one, or many photos. So, in the simplest case (that doesn’t work) I have the following:
I’m attempting to do the same thing, but can’t get this to work.
I’m sure this is due to some lack of knowledge about lua tables and strings, but I can’t figure this out.
(1) If I hardcode “attachment = { baseDir=system.DocumentsDirectory, filename=‘mtnphoto1.jpg’, type=‘image/jpg’ },” everything works fine. The generated email includes the attachment.
(2) However, I want to do this programmatically since there may be zero, one, or many photos. So, in the simplest case (that doesn’t work) I have the following: