Gmail gem上的未知命令

问题描述 投票:3回答:2

我正在尝试使用Gmail gem(source)在下一个电话中收到我的电子邮件:

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

@gmailGmail类的有效实例,此调用有时会引发下一个错误:

Unknown command v2if4084974eef.9

命令(v2if4084974eef.9)在我进行的每次通话中都会发生变化。

我究竟做错了什么?

[编辑]

规格中引发的错误是这样的

1)
Net::IMAP::BadResponseError in 'MailFacade get_data should return an array'
Unknown command v17if3069084anm.44
ruby gmail
2个回答
3
投票

我有这个问题,我在这个链接的最后评论中找到了答案:

https://github.com/nu7hatch/gmail/issues/36

您只需按照以下步骤操作:1。转到您的Google帐户设置:myaccount.google.com 2.点击“已连接的应用和网站”选项。 3.将“允许安全性较低的应用程序”设置为“开启”(靠近页面底部)。

就是这样,至少对我有用,希望它对你也有用。

来自玻利维亚的问候!!


0
投票

您需要允许“安全性较低”的应用使用您的Gmail帐户(如@xXAngelJinXx所述)。由于Google更改了UI,现在需要执行以下操作:

  1. 转到您的Google帐户设置:https://myaccount.google.com
  2. 点击左侧的“安全”
  3. 向下滚动到“安全性较低的应用访问”
  4. 点击“打开访问权限(不推荐)”
  5. 将其转为“ON”。
最新问题
© www.soinside.com 2019 - 2024. All rights reserved.