REST API is used for remotely interacting with SharePoint sites. This blog is regarding how to send email using SharePoint Rest API.

Now, you can interact directly with SharePoint objects by using any technology that supports standard REST capabilities.

REST API uses HTTP protocol, OData protocol, Client.SVC Web Service, and JSON (JavaScript Object Notation) to communicate between apps and SharePoint.

Konnectogrow will provide you the best digital marketing services in Pune and Noida, we also provide web development services, app development services, and graphic designing services in Pune you can grab the services to increase your business. Microsoft SharePoint designer 2013 training is available at Konnectogrow Pune, we can give you the best SharePoint developer training with the handling of the live project. As well as we also provide Sharepoint services and the best SharePoint consulting services in Pune. Our SharePoint designer has uploaded the SharePoint image to make you understand what is SharePoint? You can grab all services from Konnectogrow Pune.

The below example is used to send email notification to users after submission of the list item in the List.

We can send an email via SharePoint REST API so below points must be remembered

Point Must be remember
  1. End point “/_api/SP.Utilities.Utility.SendEmail” end point to send email.
  2. In JSON __metadata we used the type “SP.Utilities.EmailProperties“.
  3. The User / Group must have a read permission for particular site where we placed this site code.
  4. Your recipient must be a SharePoint site users. (And the From too) You can’t send Email from SharePoint to other email who are not in your organisation
  5. Random email accounts that have not been authenticated to SharePoint will throw an error.

<script type=”text/javascript” src=”/Style%20Library/jquery-1.11.1.min.js”></script>

<script type=”text/javascript”>

function sendEmail(from, to, body, subject) {
//Get the relative url of the site
var siteurl = _spPageContextInfo.webServerRelativeUrl;
var urlTemplate = siteurl + “/_api/SP.Utilities.Utility.SendEmail”;
$.ajax({
contentType: ‘application/json’,
url: urlTemplate,
type: “POST”,
data: JSON.stringify({
‘properties’: {
‘__metadata’: {
‘type’: ‘SP.Utilities.EmailProperties’
},
‘From’: from,
‘To’: {
‘results’: [to]
},
‘Body’: body,
‘Subject’: subject
}
}),
headers: {
“Accept”: “application/json;odata=verbose”,
“content-type”: “application/json;odata=verbose”,
“X-RequestDigest”: jQuery(“#__REQUESTDIGEST”).val()
},
success: function (data) {alert(‘Email Sent Successfully’);},
error: function (err) {alert(‘Error in sending Email: ‘ + JSON.stringify(err));}});}</script>

where   recipients = [“a@b.com”, “b@b.com”] should be in this format.

Konnectogrow will provide you the best digital marketing services in Pune and Noida, we also provide web development services, app development services, and graphic designing services in Pune you can grab the services to increase your business. Microsoft SharePoint designer 2013 training is available at Konnectogrow Pune, we can give you the best SharePoint developer training with the handling of the live project. As well as we also provide Sharepoint services and the best SharePoint consulting services in Pune. Our SharePoint designer has uploaded the SharePoint image to make you understand what is SharePoint? You can grab all services from Konnectogrow Pune.