709 - sending email

I have one final gift for you guys before I disappear for the holidays. :slight_smile:

I just finished adding SMS support to Android. Huzzah!!! This feature will be made available in build #713.

That said, please note that if the Android device does not support SMS, such as the Kindle Fire or Motorola Xoom tablet, then an alert message will be displayed onscreen that it cannot send a message. In the future, we should add a Lua function such as native.canShowPopup(ā€œsmsā€) to determine if the device supports that feature. Other than that, this feature was working well for me. Please give it a go and let me know how well it works for you. Have fun! [import]uid: 32256 topic_id: 19297 reply_id: 75238[/import]

If you start the sms composer in landscape the top blue bar saying ā€œNew Messageā€ is too high and the status bar is over it. Rotating it to portrait and landscape works fine. This only occurs when starting the sms composer in landscape.

Thanks so much for the work, please take a good break and relax…

Hoan
[import]uid: 22829 topic_id: 19297 reply_id: 75239[/import]

Hoan,

I’m using an Intent to display the SMS activity with the MIME type set to ā€œvnd.android-dir/mms-smsā€. Based on my research, this seemed to be the popular way to do it and it worked on the devices I tested it on. This way your app does not require any special permissions to be set to send an SMS message and the end-user will have access to the device’s contact list. [import]uid: 32256 topic_id: 19297 reply_id: 75241[/import]

I can’t this to work at all

looking at the code above the following should send an email… is this on the simulator or device? I’ve tried both BTW I changed the email address to mine!

local mailOptions = {
to = {ā€œrob@omnigeekmedia.comā€},
subject=ā€œHow Now Brown Cowā€,
body=ā€œThe rain in Spain falls mainly on the plain!ā€,
isBodyHtml = false,
listener=onSent
}

native.showPopup(ā€œmailā€, mailOptions)

seems simple but doesn’t work for me at all, popup doesn’t show, or email sent

error on simulator but I don’t know how to get errors working on device. I’m using CPM

[import]uid: 3093 topic_id: 19297 reply_id: 75293[/import]

@dominic.wood, this will be fixed in the next daily build (714). There was a crash bug that occured when you didn’t have the attachment property set. [import]uid: 26 topic_id: 19297 reply_id: 75318[/import]

Hey all thanks for this amazing feature! I started putting together a working sample doing some various tasks and I’m having an issue with an image attachment coming across to the recipient off my iPAD 2, on Android it works great.
Here are the bits if you want to take a look and see if messed up anything, but like I said it works great on Android. Do we need a different MIME type besides ā€œimageā€ perhaps for iOS? I haven’t done much digging yet as I just got this all together for a tutorial and realized I should check it on Apple and discovered this.
Here’s the bits (its a bit heavy for this, but like I said I was throwing together a tutorial so just check out the README, update the phone and emailTo globals and you are off and running…

Don’t forget you need to run this on a device and I’m using build 714 when making this.

Email and SMS Sample Bits
Let me know if you discover the attachment email and I will update my sample project, thanks!

Croisened

[import]uid: 48203 topic_id: 19297 reply_id: 75567[/import]

Croisened,

We may not be able to look into this until the beginning of January because most of the team is out for the holidays. So I hope you won’t mind waiting for us to look into this issue until then. [import]uid: 32256 topic_id: 19297 reply_id: 75578[/import]

Of course not, just passing along, I’m taking a break myself LOL

Just trying to help get ahead of the curve with some of these awesome new features before they become part of the baseline.

Have a great holiday and find some time to enjoy it with the ones you love!
–Croisened [import]uid: 48203 topic_id: 19297 reply_id: 75579[/import]

Thank you for understanding… and thank you for informing us of this issue. It’s very much appreciated. Great feedback like this helps us make Corona a better product for everyone.

And a happy holidays to you too! :slight_smile: [import]uid: 32256 topic_id: 19297 reply_id: 75596[/import]

Being a trial user about to purchase Corona, does the send email support Android ? I noticed in the earlier docs, it says iOS only so far ? [import]uid: 97524 topic_id: 19297 reply_id: 76059[/import]

Yes, it’s supported on Android as of daily build 2011.714. Reference docs have been updated. [import]uid: 26 topic_id: 19297 reply_id: 76062[/import]

Has anyone figured out how do to multiple attachments?

Thanks! [import]uid: 66859 topic_id: 19297 reply_id: 76469[/import]

@Croisened
Was happy to find your sample code…tested on ipad using build 715 and sad to say none seem to work apart from the blank send text…no idea why as it only works on the device and getting error feedback is tough for a number of reasons…mainly due to my not upgrading to Lion yet…but thats a whole other story…and what do you mean by taking TIMEOFF!! (never heard of such a thing) :):slight_smile: [import]uid: 85717 topic_id: 19297 reply_id: 76528[/import]

Hmmm, I just tried it again on my Ipad 2 (iOS 5) and they all work except for the attachment email example. On my Android Incredible they all work perfectly.

Same code base.

I will double check what is laying on github now…

**UPDATE**
I just pulled the bits straight from github, built (still using build 714) and deployed to the device I mentioned above and I get my same results.

Perhaps you have GPS disabled or no email setup? I don’t have any error checking in this sample, it’s just for the How-To part.

If that is not it, perhaps you have flushed out a new issue for us to look into.

Anyone else can try the sample for us?

Thanks,
Croisened [import]uid: 48203 topic_id: 19297 reply_id: 76530[/import]

i have email set up in your ā€œglobalsā€ if thats what you mean…the odd thing is i dont even get the popup…for email…yet for Text i do… im running this on an ipad 1…maybe theres some subtle difference…however the popup should have appeared methinks…location services are working fine it gave me my location on the text popup…the mystery deepens (dan dan daaaaaan)

Its mighty lonesome out here on the snow driven tundra…nuthin but polar bears and cayotes…and i dont think they use Corona…so noone else that i know of to test the code…dammit!!

UPDATE… on attachments (not to helpful im afraid)
I have seen that problem with Blank png files before on IOS .it seems that the OS compresses them in some way that i haven’t been able to figure out…if i build an app then go look at whats being stored in the bundle all the pngs appear blank…doesn’t seem to do it to jpg’s [import]uid: 85717 topic_id: 19297 reply_id: 76541[/import]

ah ha!!

I put some err detection and got the following from the blank email popup…

ā€œDirector ERROR Failed to load module ā€œhomeā€ Please check if the file exists and it is correctā€

home.lua is present in the project…

(P.S. i dont use Director as the ā€œstoryboardā€ functions now built in work really well)

im gonna grab the relevant bits of code and test in a fresh project…ill let you know how it goes…

UPDATE…Entitled ā€œIt popeth NOTā€

local ui = require(ā€œuiā€)
display.setStatusBar( display.HiddenStatusBar )

function onComplete( event )
if ā€œclickedā€ == event.action then
local i = event.index
if 1 == i then
– Do nothing; dialog will simply dismiss
end
end
end

local sendEmail = function(event)
local err = native.showPopup(ā€œmailā€)
– Show alert
if(err)then
local thestr="error "…err
local alert = native.showAlert( ā€œblank email testā€, thestr, { ā€œOKā€ }, onComplete )
end
end

function main()
local mailButton1 = ui.newButton{
default = ā€œemailbutton.pngā€,
over = ā€œemailbuttonover.pngā€,
onRelease = sendEmail,
}
mailButton1.x=400
mailButton1.y=400
end

main()
I included your buttons in the project…
this returns no errors simply doesnt work…at least not on my ipad 1 running IOS 5.01

[import]uid: 85717 topic_id: 19297 reply_id: 76544[/import]

hello,

on android, when I capture the screen image in the document directory and attach it as an attachment in the email , this fails.

anybody got it working on android with attachments?

Do I need to set permissions?

And what are intents?

Thx,

Jürgen

Happy holidays and end of year from Belgium

local pictureDir = system.DocumentsDirectory  
display.save(localGroup,"test.jpeg",pictureDir)  
native.showPopup("mail", {attachment = {baseDir=pictureDir, filename="test.jpeg" , type= "image"}})  

ps: on iOs everything works fine though [import]uid: 19590 topic_id: 19297 reply_id: 76576[/import]

hey croisened,
I have email sending with an image attachment working on IPAD2 just fine. I havn’t used your example it was along these lines and works fine

[code]
local options =
{
subject = ā€œSample Messageā€,
body = ā€œI have just emailed from IPAD2ā€¦ā€,
attachment = { baseDir=system.DocumentsDirectory, filename=ā€œemailImage.jpgā€, type=ā€œimageā€ }
}
native.showPopup(ā€œmailā€, options)

[/code] [import]uid: 21298 topic_id: 19297 reply_id: 76590[/import]

@josh_pixel

great that you got attachments to work!!..i did notice the attachment was a jpg…i think the issue is with png file you might try that and let people know how that goes…

QUESTION: How did you get the jpg file onto the system.DocumentsDirectory on the ipad???

if thats a dumb question then ignore it hehehe [import]uid: 85717 topic_id: 19297 reply_id: 76627[/import]

Thanks sembleton for pointing the image issue, switching to .jpg seems to work across the board.

.png only Works on Android.
My Sample Located here: EMS and Text Example works great! I’ll update the README now.

Now verified on Android Incredible and IPAD2, IPOD Touch

Ansca, will we be able to send .png as an attachment on iOS or is that an Apple limitation?
Thanks everyone for input, I hope the sample helps others.

–Croisened

[import]uid: 48203 topic_id: 19297 reply_id: 76666[/import]