reply to thread google-api-ruby-client

前端 未结 1 756
南旧
南旧 2021-01-28 04:36

So here\'s what my code (pretty much) looks like to create a message using the google-api-ruby-client:

  service ||= Google::Apis::GmailV1::GmailService.new

  m         


        
1条回答
  •  有刺的猬
    2021-01-28 05:23

    Looking at the source on GitHub for send_user_message shows that it doesn't take a thread_id as a parameter. However the Message class does have it as an attribute.

    So perhaps trying this should work:

      service ||= Google::Apis::GmailV1::GmailService.new
    
      message = RMail::Message.new
      message.header['To'] = params[:gmail][:to]
      message.header['From'] = current_user_google_user_id
      message.header['Subject'] = params[:gmail][:subject]
      message.header['Subject'] = params[:gmail][:subject]
      message.body = params[:gmail][:body]
      message.thread_id = params[:gmail][:thread_id]
    
      service.send_user_message(
        current_user_google_user_id,
        upload_source: StringIO.new(message.to_s),
        content_type: 'message/rfc822'
      )
    

    0 讨论(0)
提交回复
热议问题