sending email within program

Hi all,

I am trying to create the ability of a user to send an email from within an iPad program and then continue with the program. The Forums seem to say that the solution is to use something like system.openURL(“mailto:me@be.com”). However, using that solution opens the iPad Mail App and waits for the user to manually select Send. Pressing Send does send the email but does not return to the running program.

I need a solution which allows the user to compose and send an email from within a program without leaving the program or pressing anything further so the user can continue with the program.

I have seen some very clever solutions on the Forums and hope that there is a solution which I am just missing. Some sample code would be greatly appreciated.

Many thanks,

Neil
[import]uid: 9111 topic_id: 3065 reply_id: 303065[/import]

The mailto: attribute in a html link informs the browser that the link is and email, not to follow it and instead open the default mail program on that system.

What you need is a remote php / asp / whatever page which can accept a url request from within Corona. Thats totally possible, I have a game live that does something similar.

You would then connect to the url through corona http, something line www.yourdomain.com?name=Matt&email=matt@mydomain.com

You then get the php ( or whatever ) page to capture those 2 variables and then have php build the email and send it through the server the page is hosted on.

simple, not tested php code

<?php <br>$thisName = $\_REQUEST["name"];  
$thisEmail = $\_REQUEST["email"];  
  
$thisMessage = "Im a simple message";  
$thisTitle = "Im an email title";  
  
mail( $thisEmail , $thisTitle , $thisMessage , $header );  
?\>  

The header in this case is build from other options, like the from field and a bunch of other options you can add.

I have a simple script setup for just this functionality, it sends an html mail and strips it back and embeds a plain text version as well. That gets a lot more complicated and encoded images but the above code ( once you set headers ) will capture and send back a simple email [import]uid: 5354 topic_id: 3065 reply_id: 9155[/import]