Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var appweburl = "https://example.com/site";
- var urlTemplate = appweburl + "/_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': message,
- 'Subject': subject
- }
- }
- ),
- headers: {
- "Accept": "application/json;odata=verbose",
- "content-type": "application/json;odata=verbose",
- "X-RequestDigest": $("#__REQUESTDIGEST").val()
- },
- success: function (data) {
- console.log("An email was sent.");
- },
- error: function (args) {
- console.log("We had a problem and an email was not sent.");
- }
- });
- 'additionalHeaders': {
- 'content-type': 'text/html'
- }
- The property 'additionalHeaders' does not exist on type 'SP.Utilities.EmailProperties'. Make sure to only use property names that are defined by the type.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement