'Using mailto in qt webview
- Mailto is working in all browser, but in qtwebview not able to open default mail client
If i'm using mailto link directly in html it's working fine, but adding body and subject in link is not working
ex-Send email
Here's the code
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 = '[email protected]';
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();
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
