1

Here is my working query which is working absolutely fine:

function sendEmail(from, to, body, subject,cc) {
    var urlTemplate = "https://mySite.sharepoint.com/_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]
                },
                'CC': {
                    'results': [cc]
                },
                'Body': body,
                'Subject': subject
            }
        }),
        headers: {
            "Accept": "application/json;odata=verbose",
            "content-type": "application/json;odata=verbose",
            "X-RequestDigest": jQuery("#__REQUESTDIGEST").val()
        },
        success: function(data) {
         console.log('Success');
        },
        error: function(err) {
            console.log(err);
        }
    });
}

var to="user1@365appzspfx.onmicrosoft.com";
var cc="user2@365appzspfx.onmicrosoft.com";
sendEmail("admin@365appzspfx.onmicrosoft.com", to, "From Program", "Test CC",cc);

But, as soon as I use the shared mailbox in cc, i.e.

var cc="sharedMailBox@365appzspfx.onmicrosoft.com";

user1 receives the email but CC thing does not work, and even the query does not throw any error. What is missing?

  • what is you send the email directly to the shared mailbox instead of using CC? – Denis Molodtsov Sep 11 '17 at 20:11
  • Shared MailBox is neither working in "To" field nor in "CC" field. – Dilip Kumar Yadav Sep 12 '17 at 8:57
  • just by experimenting, I was led to believe that in SharePoint Online, SP.Utilities.Utility.SendEmail only sends emails to the internal users with Exchange Online license applied. Could not find any documentation that says it explicitly though. – Denis Molodtsov Sep 12 '17 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.