Skip to content

Instantly share code, notes, and snippets.

@AkashMartin1
Created August 17, 2014 03:30
Show Gist options
  • Save AkashMartin1/20ab002e7f5785ae778e to your computer and use it in GitHub Desktop.
Save AkashMartin1/20ab002e7f5785ae778e to your computer and use it in GitHub Desktop.
Gmail API Send message : ArgumentError: no method name given
@email = @google_api_client.execute(
api_method: @gmail.users.messages.send,
parameters: {
userId: 'me',
message: {
raw: {
payload: {
body: { date: 'aGVsbG8=' },
headers: [{ name: 'to',
value: 'akash@gmail.com'},
{ name: 'from',
value: 'akash@gmail.com'},
{ name: 'subject',
value: 'Hi'}],
mimeType: 'text/plain'
}
}
}
},
headers: {'Content-Type' => 'application/json'}
)
@AkashMartin1
Copy link
Author

@gmail.users.messages.send(:get)

@barnett
Copy link

barnett commented Aug 25, 2014

Where do you identify the body text?

@barnett
Copy link

barnett commented Aug 25, 2014

Mail instance then using the mightly to_s method to encode works for me. Thanks for the notes.

@smbmohanty
Copy link

I am facing the same problem. Could you please post a sample working code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment