{"id":1967,"date":"2019-06-28T16:01:58","date_gmt":"2019-06-28T14:01:58","guid":{"rendered":"https:\/\/blog.kodono.info\/wordpress\/?p=1967"},"modified":"2019-06-28T16:01:58","modified_gmt":"2019-06-28T14:01:58","slug":"sp-utilities-utility-sendemail-returns-the-e-mail-message-cannot-be-sent-make-sure-the-e-mail-has-a-valid-recipient","status":"publish","type":"post","link":"https:\/\/blog.kodono.info\/wordpress\/2019\/06\/28\/sp-utilities-utility-sendemail-returns-the-e-mail-message-cannot-be-sent-make-sure-the-e-mail-has-a-valid-recipient\/","title":{"rendered":"SP.Utilities.Utility.SendEmail returns &#8220;The e-mail message cannot be sent. Make sure the e-mail has a valid recipient.&#8221;"},"content":{"rendered":"<p>With Sharepoint you can use <a href=\"https:\/\/gist.github.com\/BasantPandey\/05189832546f2c6cc0bd008fcfec3264\">SP.Utilities.Utility.SendEmail<\/a> to send email in JavaScript, however you could receive the below error:<\/p>\n<blockquote><p>\n&#8220;The e-mail message cannot be sent. Make sure the e-mail has a valid recipient.&#8221;\n<\/p><\/blockquote>\n<p>After searching the web, I found <a href=\"http:\/\/sadomovalex.blogspot.com\/2015\/08\/one-of-reasons-of-why-sending-email-via.html\">the solution<\/a>: <b>instead of using an email address for the recipients<\/b> you have to use the <b>userDomain with &#8220;i:0#.w|&#8221;<\/b>.<\/p>\n<p>For example, if the user is John Doe, and his email is john_doe@company.com, then you should use something like <b>i:0#.w|domain\\\\john_doe<\/b>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With Sharepoint you can use SP.Utilities.Utility.SendEmail to send email in JavaScript, however you could receive the below error: &#8220;The e-mail message cannot be sent. Make sure the e-mail has a valid recipient.&#8221; After searching the web, I found the solution: instead of using an email address for the recipients you have to use the userDomain [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","hide_page_title":"","footnotes":""},"categories":[170,11,33],"tags":[123,24,151,158,117],"class_list":["post-1967","post","type-post","status-publish","format-standard","hentry","category-english","category-niveau-debutant","category-programmation","tag-english","tag-javascript","tag-niveau-debutant","tag-programmation","tag-sharepoint"],"_links":{"self":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts\/1967","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/comments?post=1967"}],"version-history":[{"count":1,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts\/1967\/revisions"}],"predecessor-version":[{"id":1968,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts\/1967\/revisions\/1968"}],"wp:attachment":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/media?parent=1967"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/categories?post=1967"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/tags?post=1967"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}