Reputation: 945
I have the code for a click to email link in HTML and it works fine on my pc but doesn't work on mobile devices (I only have Android so I don't know if the problem is only on Android or all mobile devices). When I press the link the browser says:
Webpage not available. "mailto:[email protected]?subject=Mileage%20%20%20&body="Todays%20date:%0D%0ABusiness%20Mileage:%0D%0ADid%20you%20have%20a%20business%20passenger?%0D%0AAdditional%20details:" might be temporarily down or it may have moved permanently to a new web address.
Can someone please tell me how to fix this problem it is vital that the Click to send email link works.
My code is below:
<p>
<a href="mailto:[email protected]?subject=Mileage&body="Todays date:%0D%0ABusiness Mileage:%0D%0ADid you have a business passenger%0D%0AAdditional details:">
Click to send email
</a>
</p>
Upvotes: 3
Views: 14503
Reputation: 51
Your application need access for mail related apps.This can be achieved by adding following piece of code in
config.xml
<access origin="mailto://*" launch-external="true" />
then it will work
Upvotes: 0
Reputation: 549
Use this code to invoke the mailing applications in mobile and set the subject, and body of email as well.
Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
emailIntent.setData(Uri.parse("mailto:[email protected]"));
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Body");
try {
startActivity(emailIntent);
} catch (ActivityNotFoundException e) {
Toast.makeText("No email client found",
Toast.LENGTH_LONG).show();
}
Refer Send Email Intent for examples
Upvotes: 0
Reputation: 1988
That's an issue with Android OS:
Issue 63538: Mailto links are parsed incorrectly, entered entirely into the address field
Devices Confirmed: Nexus 4 (two devices tested)
Android Version: 4.4.2 only (tested in 4.3 and 4.4.0)Bug details:
Mailto links are entirely entered into the address field instead of being parsed into Address, Subject and Body. Screenshot is attached showing issue.
Upvotes: 1
Reputation: 4629
Here's an example of mailto
which works just fine on mobile, so you must've just formed your URL incorrectly (check your ""s).
MAILTO Link in email to start a new email
Upvotes: 0