Hi @Dhananjay_Patil
You can achieve your requirement using Http Trigger method PowerAutomate.
Please refer below blogs to create Power Automate: https://medium.com/@zaab_it/microsoft-flow-send-email-from-http-request-f6577ad46b2c
After creation of power automate, you will get HTTP POST URL. Then you can add that url in httpTriggerUrl variable in below code.
function sendEmail(){
var objEmail = {};
objEmail.subject = "This is subject";
objEmail.to = "receiver@outlook.com";
objEmail.body = "This is body";
var stringJSON = JSON.stringify(objEmail);
var httpTriggerUrl = "https://prod-29.westus.logic.azure.com:443/workflows/5192b9bc428746ec93b21e6c8f9d0fe7/triggers/manual/path";
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
datatype: "json",
url: httpTriggerUrl,
data: stringJSON,
async: true,
beforeSend: function (XmlHttpRequest) {
XmlHttpRequest.setRequestHeader("Accept", "application/json");
XmlHttpRequest.setRequestHeader("Content-Type", "application/json; charset=utf-8");
XmlHttpRequest.setRequestHeader("OData-MaxVersion", "4.0");
XmlHttpRequest.setRequestHeader("OData-Version", "4.0");
},
success: function (data, textStatus, XmlHttpRequest) {
alert("success");
},
error: function (xmlHttpRequest, textStatus, errorThrown) {
alert(xmlHttpRequest.responseJSON.error.message);
}
});
}
You have to add this code in Page's localized content. You also have to add button in your web page.
<button onclick="sendEmail();">Send Email</button>
--------------------------
If you like this post, give a Thumbs up. Where it solved your query, Mark as a Solution so it can help other people!