Creating draft via Google Gmail API

后端 未结 2 1044
谎友^
谎友^ 2020-12-04 03:39

I am trying to create a draft message for a logged in user but keep getting the error Missing draft message when I run the below

require \'googl         


        
2条回答
  •  借酒劲吻你
    2020-12-04 04:13

    I had the same issue when I was trying to do this for the first time as well. The solution that I found was to not include the message information as part of the parameters, but rather pass that on in the :body_object as shown below.

    @result = client.execute(
      :api_method => gmail.users.drafts.create,
      :parameters => {
        'userId' => "me"      
      },
      :body_object => {
        'message' => {
          'raw' =>  Base64.urlsafe_encode64('Test Email Message')
        }
      }
    )
    

提交回复
热议问题