Gmail api with .Net CLient library: Missing draft message [400]

后端 未结 3 1066
面向向阳花
面向向阳花 2021-01-06 09:30

I\'m trying to create drafts in Gmail using the .Net Client Library. I can successfully login and retrieve a list of drafts so the authentication and api are working. Now I

3条回答
  •  星月不相逢
    2021-01-06 09:46

    message > raw is expected to be the full SMTP message.

    {
        "message": {
          "raw": "From: me@example.com\nTo:you@example.com\nSubject:Ignore\n\nTest message\n"
    }
    

    Alternatively, you can also set the appropriate fields in message > payload:

    {
        "message": {
          "payload": {
              "headers": {
                  {"name": "From", "value": "me@example.com},
                  {"name": "To", "value": "you@example.com"},
                  {"name": "Subject", "value":"Ignore"}
               },
               "body": {
                  "data": "Test message"
               }
           }
        }
    }
    

提交回复
热议问题