Mail on Android - Attachment not ok

Hi Stephen,

Sorry to leave you hanging. Yes, I did get a response from B&N, but not a solution. It’s looking like the Nook’s mail app requires file attachments to be copied to external storage (aka: SD card) first. This is a different behavior compared to other mail apps where they allow direct file access via Android’s ContentProvider classes, which is how Corona does it. We want to avoid copying files to external storage because it can be a major performance hit and needlessly wastes storage space. Especially for large files. The next step for us is to work with B&N and experiment with alternative solutions. We just haven’t had the time to do that yet.

I’m back in feature development mode this week. So, there aren’t going to be any Android bug fixes this week. We’ll be going back to bug fixing mode next week. I’ll let you know then when we’ll be able to look into this. In fact, feel free to post me a reminder next week just in case. Sorry about the delay. We’ve just got a lot to do here. But we definitely consider this a high priority bug. [import]uid: 32256 topic_id: 19798 reply_id: 125468[/import]

Hi Joshua,

Thanks for the detailed response (even though it’s not the answer I was hoping for). I will definitely ping you again next week.

Since you’re in feature development mode maybe this could be a good opportunity to add external/SD storage access for Android to Corona. That could possibly solve this issue and provide a new feature I know a few others have asked about.

Ok, I won’t push my luck anymore :wink:

EDIT: I just realized the other app that does support image attachments on Nook Color must not rely on an SD card, since my Nook Color doesn’t have an SD slot. It lets the user select images from the device’s image gallery/photo library. So maybe what I really need is the ability to save a display group as an image to the gallery ( since display.captureScreen allows saving to the photo album already maybe this is trivial?) and then the ability to attach an image from the gallery to an email (currently not possible, and searching for a particularly named image in the gallery is also not possible with Corona as far as I can tell). No SD card required.

[import]uid: 9422 topic_id: 19798 reply_id: 125487[/import]

Regarding external storage SD card support, we haven’t received a lot of requests for this until the past 2 weeks (that I’m aware of). If more people request this, then that will definitely raise the priority of that feature and get it on our roadmap.

Currently, we’re focusing on highly requested features that you see on our roadmap today (please see the link below). The Android feature that we are working on this week is local/scheduled notifications… which will lay the foundation for push notifications.
http://www.coronalabs.com/resources/roadmap/

Also, “external storage” on Android isn’t always external. It can be a separate “volume” on the same internal storage device, which is how it works on Nook. What makes “external storage” valuable in the Android world is that it’s a public place to keep files that are accessible to all applications, much like how the “My Documents” directory works on Windows. In fact, this is typically how photos are passed between a camera app and a 3rd party app… or a 3rd party app passing a photo to the Gallery app. It’s a massively abused volume used to pass files between apps. We’re trying our best not to do the same with Corona.

I still can’t think of a work-around. Like you said, there’s currently no way to fetch the path to an external file, such as from the gallery. Hmm… [import]uid: 32256 topic_id: 19798 reply_id: 125498[/import]

Hi Joshua,

You requested I remind you about this issue. I’m still seeing the “image too large to attach” on the Nook Color when I try to attach a (not very big) image to an email. Any word from B&N re: a fix or workaround?
[import]uid: 9422 topic_id: 19798 reply_id: 128644[/import]

B&N is focusing on Nook HD at the moment. So, there are no known work-arounds that you can do on your end yet. And there is no one available to work on this on our end at the moment either.

I hate to say it, but your only option is to abandon file attachments on the Nook at the moment. You may have to look into alternatives such as uploading the file to a server and perhaps e-mail a link to it. If it’s an image file, then perhaps another option is to upload it to facebook which our facebook API does support.

Resolving this issue is still on our to-do list, but we have several other tasks that we have to take care of first. Just being honest with you. [import]uid: 32256 topic_id: 19798 reply_id: 128659[/import]

Hi Joshua,

You requested I remind you about this issue. I’m still seeing the “image too large to attach” on the Nook Color when I try to attach a (not very big) image to an email. Any word from B&N re: a fix or workaround?
[import]uid: 9422 topic_id: 19798 reply_id: 128644[/import]

B&N is focusing on Nook HD at the moment. So, there are no known work-arounds that you can do on your end yet. And there is no one available to work on this on our end at the moment either.

I hate to say it, but your only option is to abandon file attachments on the Nook at the moment. You may have to look into alternatives such as uploading the file to a server and perhaps e-mail a link to it. If it’s an image file, then perhaps another option is to upload it to facebook which our facebook API does support.

Resolving this issue is still on our to-do list, but we have several other tasks that we have to take care of first. Just being honest with you. [import]uid: 32256 topic_id: 19798 reply_id: 128659[/import]

Stephen,

Good news! We’ve found a solution that allows e-mail file attachments to work on a Nook Color. This fix will be made available in daily build #978, tomorrow. Thank you for your patience. [import]uid: 32256 topic_id: 19798 reply_id: 134252[/import]

That’s great news! We’re “days away” from submitting to B and N so your timing is just in time. Thanks for the fix! I look forward to testing it out tomorrow.

-Stephen [import]uid: 9422 topic_id: 19798 reply_id: 134258[/import]

I have an app of mine right now that is getting this error on the new Nook HD+ i just got.

Any chance that this work around fix in build 978 will also help this issue out on ALL nook devices? [import]uid: 88147 topic_id: 19798 reply_id: 134265[/import]

Tomorrow’s daily build “should” fix this issue on the Nook HD devices as well, although I have not been able to verify that for myself. They all use the same B&N made mail app and the problem was caused by Corona not providing some additional file information that was required by their mail app. If you could verify that build #978 fixes this problem on your Nook HD+, then that would be great.
Thanks! [import]uid: 32256 topic_id: 19798 reply_id: 134269[/import]

Hi Joshua,

I had a chance to test the fix in build #978 on an Nook Color and iPad today. While sending email with attachments technically works, there are still a couples problems that make it not quite fully functional.

As background, in my app the user can use images they’ve previously saved in a folder in their documents directory as multiple image attachments in an email. I followed the advice in the tutorial here to create a table used to construct an email message with attachments: http://www.coronalabs.com/blog/2012/01/03/composing-email-and-sms-in-corona/

The code looks something like
[lua] local attachmentTable = {}
for i = 1, #photosTable do
attachmentTable[i] = {baseDir=system.DocumentsDirectory, filename= “BGPhotos/”…photosStuffTable[i].name, type=“image”}
end

local options =
{
–to = “john.doe@somewhere.com”,
–subject = CurrentEntryTable.timedate,
body = DataController.getCurrentText(),
attachment = attachmentTable,
}

native.showPopup(“mail”, options) [/lua]

On the iPad, everything works great. Multiple images can be imported into the native email composition tool. When I send the message it appears (In thunderbird) with either the images in line within the text body if there’s only one image, or as a list of attached images that can be saved if there’s more than one image attached.

On the Nook Color, though, if there is only one image attached is comes through as a garbled mash of text characters in line with the body text. It is “technically” working because the attachment can still be saved from the email program and it can indeed be loaded correctly into an image editing program, but within the email itself it looks like a whole bunch of garbage text. Even worse, if I attach more than one image to the email, the email is sent without any attachments, garbage or otherwise. Both platforms are using the same code.

When I examined the source of the email messages sent from the iPad and Nook I saw some notable differences.

On iPad (working correctly):

[text]
–Boundary_(ID_+qh4r7XE2uK9TF9RQGCd2A)
Content-type: image/jpg; name=“BGphoto 1354998101.jpg”
Content-transfer-encoding: base64
Content-disposition: inline; filename=“BGphoto 1354998101.jpg”

/9j/4AAQSkZJRgABAQAAAQABAAD/4QBYRXhpZgAATU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQA
AAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAACIqADAAQAAAABAAABmgAAAAD/2wBD
AAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB…
[/text]
And on Nook (email program displays images as a long string of ascii):
[text]
Content-Type: ;
name=“BGphoto 1355009495.jpg”
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename=“BGphoto 1355009495.jpg”;
size=20830

/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkz
ODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2Nj
Y2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wAARCAHgAYoDASIA…
[/text]

The obvious difference to me is the email formed on the iPad shows “Content-type: image/jpg;” while the email formed on the Nook shows a blank content type “Content-Type: ;” From the code above you can see I’m setting the content type to “image” when I create the email, and it’s the identical code running on both platforms. So thunderbird isn’t able to guess correctly about the attachment being an image, but the Nook isn’t setting the image type correctly to begin with.

I’m not sure what would explain multiple attachments failing completely on Nook, but given that the identical code works fine on the iPad I’m guessing it’s something I can’t fix on my end and can only be addressed by Coronalabs.

Let me know if there’s any more info. I can provide towards a solution to these issues. And thanks again for taking a look.

-Stephen [import]uid: 9422 topic_id: 19798 reply_id: 134350[/import]

Bummer. Well, I’m going to need your help reproducing this issue because I did test multiple file attachments on a Nook Color (along with many other devices) before pushing in this code change. You probably found an edge case that we haven’t tested.

Are you able to reproduce this issue with our sample app “Networking/ComposeMailSMS” that is included with the Corona SDK? That sample app attaches 2 files from the resource directory.

Also, does your app work if you attach just 1 file from the Documents directory?
(I know I’ve tested this and it worked for me.)

How about 2 files from the Documents directory?
(I didn’t test this, but perhaps that’s the edge case we are looking for?)

Also, are you deleting these files right after you show the mail popup? If so, then you are probably deleting the files before the mail app has a chance to send them.

Nothing that you type into the mime type field will make a difference. The mime type that you’ve entered is ignored because Android infers it based on the file’s extension. I’ve also tested attaching both *.jpg and *.png files and have verified that my mail client correctly receives those image.

If you can isolate this and give us a reproducible case, then that would be a big help, because at this point we’re stuck since we can’t reproduce this issue on our end. These things are never that simple, eh? But no worries, I’m sure we’ll track it down. [import]uid: 32256 topic_id: 19798 reply_id: 134441[/import]

Hi Joshua and Stephen,

I’ve also had this issue on Android.
My test Android (Nexus One), has 2 different mail clients.
One that works (Google Mail), and one that doesn’t (Email).
The “Google Mail” client icon has a red M in the envelope and the “Email” client icon has a yellow icon with an @ inside the envelope.
I’m not sure if you have both options but this would be the easiest way to replicate the issue.
It fails sending any image number either .png and .jpg, and using either Temp or Documents directory.

Deano
[import]uid: 67683 topic_id: 19798 reply_id: 134460[/import]

I just realized there may be a fix in the latest build. I was using 971.
I’ll download #978 and let you know how it goes. [import]uid: 67683 topic_id: 19798 reply_id: 134463[/import]

Wooohooooo FIXED!!!
Perfect timing! I had a deadline today and they client was getting upset about this bug.

Just to be clear this Build #978 has fixed :
Sending 1 screengrabed .png file from the Documents directory for Androids “Email” client. Google Mailis also working.

I also added a .5 second delay on the mail popup. (not sure if this made a difference in the end but it works now so I’m stoked :slight_smile:

Thanks Joshua and Stephen!

Deano [import]uid: 67683 topic_id: 19798 reply_id: 134465[/import]

Yes build #978 fixed the email issue for me on my Nook HD+.

great timing for this fix, This app is getting ready to go out the door, and i was going to have to exclude it from the nook store for now. But now i don’t have too! [import]uid: 88147 topic_id: 19798 reply_id: 134496[/import]

Stephen,

Good news! We’ve found a solution that allows e-mail file attachments to work on a Nook Color. This fix will be made available in daily build #978, tomorrow. Thank you for your patience. [import]uid: 32256 topic_id: 19798 reply_id: 134252[/import]

That’s great news! We’re “days away” from submitting to B and N so your timing is just in time. Thanks for the fix! I look forward to testing it out tomorrow.

-Stephen [import]uid: 9422 topic_id: 19798 reply_id: 134258[/import]

After an all-nighter and about 20 trips from the simulator to the Nook, I found the root of all my problems. Spaces in the image file name!

For example, an image with the name “photo 14.png” can be attached to an email on Nook, but the email client will show the image file as garbage text inline with the message. And If I have two images attached, say
“photo 14.png”
“photo 15.png”

Then neither one is attached and the mail is sent without any images.

However, if I use names without spaces
“photo14.png”
“photo15.png”
They both get attached to the email, and the email clients shows both images correctly inline as images.

Note that iOS handled the spaces in file names just fine (which made this all the more difficult to track down).

Anyway, Joshua, thanks again for the fix in #978. I think I can finally release on both platforms with identical functionality.

-Stephen
[import]uid: 9422 topic_id: 19798 reply_id: 134513[/import]