我正在尝试使用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
@gmail
是Gmail
类的有效实例,此调用有时会引发下一个错误:
Unknown command v2if4084974eef.9
命令(v2if4084974eef.9)在我进行的每次通话中都会发生变化。
我究竟做错了什么?
[编辑]
规格中引发的错误是这样的
1)
Net::IMAP::BadResponseError in 'MailFacade get_data should return an array'
Unknown command v17if3069084anm.44
我有这个问题,我在这个链接的最后评论中找到了答案:
https://github.com/nu7hatch/gmail/issues/36
您只需按照以下步骤操作:1。转到您的Google帐户设置:myaccount.google.com 2.点击“已连接的应用和网站”选项。 3.将“允许安全性较低的应用程序”设置为“开启”(靠近页面底部)。
就是这样,至少对我有用,希望它对你也有用。
来自玻利维亚的问候!!
您需要允许“安全性较低”的应用使用您的Gmail帐户(如@xXAngelJinXx所述)。由于Google更改了UI,现在需要执行以下操作: