Hi guys,
As the title says, I have built an app in Construct2 and part of the functionality sends an email via javascript and the AJAX object.
This works perfectly on my phone when I export it as an HTML5 website, but when I export it as a debug APK (using Cordova) the email sending does not work, but the rest of the app does - any ideas, am I missing something obvious?
I have used code snippets that people have posted as examples and as I say it works when running as a site.
This used to work when building the APK via Cocoon.io but since they are no longer providing that service I have switched to Cordova and it no longer works.
The javascript that gathers the data from controls in the app is as follows:-
"document.getElementById(""myText2"").select();document.execCommand('copy');"
and the AJAX commands are:-
Send
Tag: "Email"
URL: "http://www.myurl.com/c2mail.php"
Data: "subject="&Subject&"&message="&message&"&email_to="&email_to
Method: "post"
Request
Tag: "sent"
URL: "http://www.myurl.com/c2mail.php"
Contents of c2mail.php
<?php
$to = $_POST['email_to'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$headers ='From: fromkal@email.com' . "\r\n" .
'Reply-To: fromkal@email.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
echo "Message sent at ";
echo date ("h:i:s");
?>
My device is Android 9 - I am wondering if this is something to do with it, I wonder if it requires an SSL cert on the URL domain?
Does anyone have any ideas?
Thanks in advance!