I don't understand how to pre-populate To field of the email client.
content.shareInformation = function (title, text, url, dialogTitle) {
if (content.isCapacitorMobileApp) {
Share.share({
title: title,
text: text,
url: url,
dialogTitle: dialogTitle
}).then(() => window.console.log("Successful share")).catch((error) => window.console.log("Error sharing", error));
}
};
Subject and Body is getting populated right. But To field is not getting populated.
for mail you should be able to do it with mailto instead of the share plugin
I have tried this but nothing happens.
window.open("mailto:" + AppConst.errorReporting.mailto + "?subject=" + AppConst.jsonBlobReporting.subject + "&body=" + vm.reportdata, "_self");
iOS? Android? both?
and with a regular anchor tag? or with window.location = 'mailto...'?
iOS.
Let me try anchor and window.location.
It was not working because email account was not configured in the simulator. It works on real device.
All of these options work:
<ul>
<li><a href="mailto:[email protected]">Email Us</a> </li>
<li><a href="mailto:[email protected]?subject=Mail from Our Site">Email Us</a></li>
<li>
<a data-rel="external" id="btnUploadPics" v-on:click="sendmail" data-role="button" data-align="right">Add Photos</a>
</li>
</ul>
sendmail() {
var sLink = "mailto:[email protected]?subject=test";
//window.open(sLink, "emailWindow");
window.location.href = sLink;
}
Most helpful comment
It was not working because email account was not configured in the simulator. It works on real device.
All of these options work: