I want to send email with attachments in share-point hosted app,how can I do that?i tried some thing like below
function sendMail() {
var mail = {
properties: {
__metadata: { 'type': 'SP.Utilities.EmailProperties' },
From: '[email protected]',
To: { 'results': ['[email protected]'] },
Body: 'some body',
Subject: 'subject'
}
};
var getAppWebUrlUrl = decodeURIComponent(utils.getQueryStringParameter("SPAppWebUrl").replace("#", ""));
var urlTemplate = getAppWebUrlUrl + "/_api/SP.Utilities.Utility.SendEmail";
$.ajax({
contentType: 'application/json',
url: urlTemplate,
type: "POST",
data: JSON.stringify(mail),
headers: {
"Accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val()
},
success: function (data) {
alert('success')
},
error: function (err) {
alert(JSON.stringify(err));
}
});
}
but it is without attachment. And giving error for SP.Utilities.Utility
.