Q:

Unknown command on Gmail gem

I'm trying to get my emails using the Gmail gem (source) with the next call:
class MyClass
  def initialize account, credentials
    @gmail = Gmail.connect(account, credentials)
  end

  def get_attachments received_at, options
    mails = @gmail.inbox.find(
      :to => options[:to],
      :has=>:attachments,
      :before => options[:end_date],
      :after => received_at
     )
     #more code
   end
end

@gmail is a valid instance of Gmail class, and this call raises sometimes the next error: 
Unknown command v2if4084974eef.9

The command (v2if4084974eef.9) changes in every call I make.
What am I doing wrong?
[Edit]
The error raised in specs is this
1)
Net::IMAP::BadResponseError in 'MailFacade get_data should return an array'
Unknown command v17if3069084anm.44

A:

I had this issue and I found the answer to this in the last comment on this link:
https://github.com/nu7hatch/gmail/issues/36
You just have to follow these steps:
1. Go to your Google account settings: myaccount.google.com
2. Click on "connected apps & sites" option.
3. Turn "Allow less secure apps" to "ON" (near the bottom of the page).
That's it, at least works for me, hope it works for you aswell.
Greetings from Bolivia!!

