web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Send mail to shared ma...
Power Automate
Unanswered

Send mail to shared mail box using "Send an http request to sharepoint"

(0) ShareShare
ReportReport
Posted on by 12

Hello all,

 

I am trying to send mail to "shared mail box" - abc@xz.com through Json code via "send an http mail to SharePoint" method in one of my workflows. 

I tried by creating a variable for that mail box (string) and then set that variable with mail id (abc@xz.com). and then i called that variable in my code:

 

 

 { 
 'properties': { 
 '__metadata': { 
 'type': 'SP.Utilities.EmailProperties' 
 }, 
 'To': { 
 'results': @{variables('Task Owner Email ID')}
 }, 
'BCC':{ 
'results': @{variables('team shared mail box')}
},
 'CC': { 
'results': ['Team Group'] 
},
 'Body': '@{variables('Reminder Email Body')}',
 'Subject': 'Reminder - Task - @{items('Apply_to_each_item_in_team_List')?['Title']}' 
 } 
}
____

 

 

This part in above code seems to be not working: 'BCC':{
'results': @{variables('team shared mail box')}
},

 

However in the output it looks like it does recognize the mail id but throws below error:

 

 

"body": {
 "status": 400,
 "message": "An unexpected 'PrimitiveValue' node was found when reading from the JSON reader. A 'StartArray' node was expected.\r\nclientRequestId: 74f71b44-8513-4ef1-a5f8-b95235c14dac\r\nserviceRequestId: 9e4b8fa0-e007-6000-1178-c83305bb7607",
 "source": "https://sites.xz.com/sites/team/_api/SP.Utilities.Utility.SendEmail",
 "errors": [
 "-1",
 "Microsoft.Data.OData.ODataException"
 ]
 }
}

 

 

 

Rahul_Vaish_0-1674544319426.png

can someone help with this .. how to fix it or is there another way to write the code to make it work.

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @Rahul_Vaish,


    Can you try the below instead and see if that works?

     

    In this example I used double quotes for the body payload. And I would also suggest to add verbose Accept & Content-Type headers to your request, if you haven't already.

     

    Headers

     

     

    {
     "Accept": "application/json;odata=verbose",
     "Content-Type": "application/json;odata=verbose"
    }

     

     

     

    Body

     

     

     

    {
    "properties":
    {"__metadata": {"type":"SP.Utilities.EmailProperties"},
    "From":"",
    "To": {"results":["@{variables('Task Owner Email ID')}"]},
    "BCC": {"results":["@{variables('team shared mail box')}"]},
    "CC": {"results":["teamgroup@xz.com"]},
    "Body":"@{variables('Reminder Email Body')}",
    "Subject":"Reminder - Task - @{items('Apply_to_each_item_in_team_List')?['Title']}"
    }
    }

     

     

     

    Below is an example which I shared earlier on these forums:

    https://powerusers.microsoft.com/t5/Building-Flows/SharePoint-HTTP-connector-JSON-syntax-for-To-and-CC-fields/m-p/1199664/highlight/true#M138578

     

  • Rahul_Vaish Profile Picture
    12 on at

    Thanks for the reply..

    I am already using same headers as suggested by you.

     

    {
     "Accept": "application/json;odata=verbose",
     "Content-Type": "application/json;odata=verbose"
    }

     

     

    And strange think happened, after i replaced all the single qoutes(') with (") i was not able to put it in "send an http request to sharepoint" connector. But , i just replaced the BCC part with (") and i can see flow didn't failed. I guess it worked.. but no mails received.. 

    Let me take a look again and will share an update with you..

     

    Thanks  a lot 🙂 

  • Rahul_Vaish Profile Picture
    12 on at

    Somehow, workflow didn't fail but mail didn't went through to the shared mail box. I put the shared mail box in BCC, it recognizes it as per the logs but couldn't send the mail to the mailbox.

    i found this article in which they are suggesting this:

    Anyways, the much simpler solution is to simply add the Shared Mailbox's email address to an existing "Members" SP group within the site collection of the chosen relative server URL (used in conjunction within the standard REST API processSendEmails() and sendEmail() functions. After this, emails will send to that particular Shared Mailbox -- so long as its domain is also valid. As soon as I did this, the "Valid recipient" error subsided and emails were received to the Shared Mailbox from the server.

    (https://social.technet.microsoft.com/Forums/ie/en-US/ccae06db-6218-45be-b332-20a5b33e8961/not-able-to-send-emails-to-the-shared-mailbox-in-sharepoint-2013-with-rest-api?forum=sharepointgeneral,)

    Did you had to provide this permission to make it work? 

  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @Rahul_Vaish,

     

    I have not tested it with a Shared Mailbox in the BCC. I can try later today. 

     

    However, it looks like that thread was primarily about SharePoint 2013. So, I would not except this to be an issue in SharePoint Online, since the e-mail would have the same domain as where you are sending it from, correct?

     

    Just to double check. It is not in the junk or spam folder, right? 😁

  • Rahul_Vaish Profile Picture
    12 on at

    Well, it's not in junk or spam folder 😄 

    And yes it is about sharepoint online and both domains are same. i tried putting the shared mail box id on cc as well, didn't work.

  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @Rahul_Vaish,

     

    Could be a Shared mailbox setup kind of thing? Have you double checked if the shared mailbox can receive any internal and external e-mail? 

  • Rahul_Vaish Profile Picture
    12 on at

    We are able to receive mails from external(gmail.com or any other external.com) and internal(xz.com). But in this case, mail is being sent from no-reply@sharepointonline.com to abc@xz.com (shared mail box id) which is failing. 

    I tried with both cc and bcc.. 

  • Rahul_Vaish Profile Picture
    12 on at

    yes, looks like that. 

    Shared mail box is not logon enabled, any member who is member of the group associated to this shared mail box is configuring it to their outlook via windows credentials. This the reason why i can't add it to any sharepoint group, neither it resolves in Powerautomate workflow specially when it is configured as "Send an http request to sharepoint".

     

  • Rahul_Vaish Profile Picture
    12 on at

    i was able to do that using this connector "Send an Email from Shared Mailbox (v2)". 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard