- Mailto 在所有浏览器中工作,但在 qtwebview 中无法打开默认邮件客户端
如果我直接在 html 中使用 mailto 链接,它工作正常,但在链接中添加正文和主题不起作用前发送电子邮件
这是代码
mailpopup(){
const userAgent = window.navigator.userAgent;
alert(userAgent);
if(this.model.firstName == undefined || this.model.firstName == null){
this.model.firstName = 'No comments';
alert(this.model.firstName);
}
else{
this.model.firstName;
alert(this.model.firstName);
}
if(this.model.firstName2 == undefined || this.model.firstName2 == null){
this.model.firstName2 = 'name@exp.com';
alert(this.model.firstName2);
}
else{
this.model.firstName2;
alert(this.model.firstName2);
}
var maillen = JSON.parse(sessionStorage.getItem('log Data'));
if (maillen.length > 1) {
if (environment.production == false) {
var a
if(userAgent.includes('Firefox/')){
a = maillen.slice(-7);
}
else{
a = maillen.slice(-2);
}
}
else {
if(userAgent.includes('Firefox/')){
a = maillen.slice(-10);
}
else{
a = maillen.slice(-2);
}
}
var testmail = JSON.stringify(a);
alert(testmail);
}
var bodyText = 'userAgent Details: ' + userAgent + '%0D%0A' + "Device Details: " + localStorage.getItem('devicedetails') + '%0D%0A' + 'User Comments: ' + this.model.firstName + '%0D%0A' +'%0D%0A' + [testmail.replace(/\},/g, "%0D%0A")];
const text = `mailto:${this.model.firstName2}?&subject=Error
Logs&body=${bodyText}`
alert(text);
var mail = document.createElement("a");
mail.href = text;
mail.target = "_self"
mail.click();
}