Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

382
Views
400 Error Invalid Recipient Err Microsoft Graph API

I am trying send email through Microsoft graph api. I created a message object like the following. {"message":{"subject":"hellowolrd","body":{"contentType":"text","content":"wow"}},"toRecipients":{"emailAddress":{"address":"example@yahoo.com"}}}

But gets 400 error with invalid recipient. Can anybody help me why I am getting this error.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

It seems you have a syntax issue in your JSON request.Look closely after content you have an extra closing } which means you are not posting 'toRecipients' in the message.

{"message":{"subject":"hellowolrd","body":{"contentType":"text","content":"wow"}},"toRecipients":{"emailAddress":{"address":"example@yahoo.com"}}}

Instead try below JSON to make it work - { "message": { "subject": "hellowolrd", "body": { "contentType": "text", "content": "wow" }, "toRecipients": [ { "emailAddress": { "address": "example@yahoo.com" } } ] } }

Thanks!

over 4 years ago · Santiago Trujillo Report

0

The invalid recipient was caused by a different json structure. I had to exactly match the following structure that was provided in one of their example.

 $mailArgs ='
{
    "message": {
        "subject": "Meet for lunch?",
        "body": {
            "contentType": "Text",
            "content": "Lunch Invited"
        },
        "toRecipients": [
            {
                "emailAddress": {
                    "address": "example@example.com"
                }
            }
        ]
    }
    }';

So I created a JSON array to match exactly the same structure and it worked!

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!