Generating an email without the url opening externally

151
1
Jump to solution
09-13-2018 04:18 PM
GiatriLalla
New Contributor III

I want to send an email but I do not want the url page to open up externally. How can this code be modified to do that? Thank you.

var urlInfo = AppFramework.urlInfo("mailto:***@gmail.com"), //Instantiates UrlInfo with an email address
                deviceDetails = [ //Collects information about both the device and app
                    "%1: %2 (%3)".arg("Device OS").arg(Qt.platform.os).arg(AppFramework.osVersion),
                    "%1: %2".arg("Device Locale").arg(Qt.locale().name),
                    "%1: %2".arg("App Version").arg(app.info.version),
                    "%1: %2".arg("AppStudio Version").arg(AppFramework.version),
                ];
            urlInfo.queryParameters = { //Uses queryParameters property to populate email subject and body
                "subject": "%1 %2".arg("Feedback for").arg(app.info.title),
                "body": "\n\n%1".arg(deviceDetails.join("\n"))
            };
            Qt.openUrlExternally(urlInfo.url); //Uses Qt framework to open constructed UrlInfo
Tags (3)
0 Kudos
1 Solution

Accepted Solutions
ErwinSoekianto
Esri Regular Contributor

Giatri, 

Let me clarify if I understand your question, you are asking how to send an email without opening the email client, correct? 

To do that you would need some sort of 3rd party "web hook" services or email SMTP services. One of the famous ones is by Zapier , in short, you would set the workflow to send an email if a URL is being called, you can set then grab the parameter(s) in the URL to be added as the dynamic contents of the email.

Then you would call this URL from AppStudio app, using NetworkRequest, instead of doing the above code you outlined. Then an email will be sent by the 3rd party after they (Zapier) received the URL request. 

I am attaching short video from Zapier when I tried doing this

I hope this helps,

Erwin

View solution in original post

1 Reply
ErwinSoekianto
Esri Regular Contributor

Giatri, 

Let me clarify if I understand your question, you are asking how to send an email without opening the email client, correct? 

To do that you would need some sort of 3rd party "web hook" services or email SMTP services. One of the famous ones is by Zapier , in short, you would set the workflow to send an email if a URL is being called, you can set then grab the parameter(s) in the URL to be added as the dynamic contents of the email.

Then you would call this URL from AppStudio app, using NetworkRequest, instead of doing the above code you outlined. Then an email will be sent by the 3rd party after they (Zapier) received the URL request. 

I am attaching short video from Zapier when I tried doing this

I hope this helps,

Erwin