Advertisement
Guest User

Untitled

a guest
Jul 29th, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. var appweburl = "https://example.com/site";
  2. var urlTemplate = appweburl + "/_api/SP.Utilities.Utility.SendEmail";
  3.  
  4. $.ajax({
  5. contentType: 'application/json',
  6. url: urlTemplate,
  7. type: "POST",
  8. data: JSON.stringify({
  9. 'properties': {
  10. '__metadata': { 'type': 'SP.Utilities.EmailProperties' },
  11. 'From': from,
  12. 'To': { 'results': [to] },
  13. 'Body': message,
  14. 'Subject': subject
  15. }
  16. }
  17. ),
  18. headers: {
  19. "Accept": "application/json;odata=verbose",
  20. "content-type": "application/json;odata=verbose",
  21. "X-RequestDigest": $("#__REQUESTDIGEST").val()
  22. },
  23. success: function (data) {
  24. console.log("An email was sent.");
  25. },
  26. error: function (args) {
  27. console.log("We had a problem and an email was not sent.");
  28. }
  29. });
  30.  
  31. 'additionalHeaders': {
  32. 'content-type': 'text/html'
  33. }
  34.  
  35. 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