Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

384
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda