Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

383
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda