ruby-gmail:未捕获的异常:534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbtMk

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27586940/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 06:39:11  来源:igfitidea点击:

ruby-gmail: Uncaught exception: 534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbtMk

rubyemailgemgmail

提问by anyvoleki

I can manually login my account, but when i use ruby-gmail, it will raise err

我可以手动登录我的帐户,但是当我使用 ruby​​-gmail 时,它会引发 err

this is my code

这是我的代码

require 'gmail'

gmail = Gmail.new("[email protected]", "passwd")

gmail.deliver do
  to "[email protected]"
  subject "Having fun in Puerto Rico!"
  text_part do
    body "Text of plaintext message."
  end
  html_part do
    content_type 'text/html; charset=UTF-8'
    body "<p>Text of <em>html</em> message.</p>"
  end
  add_file __FILE__
end

this is my full output

这是我的完整输出

Uncaught exception: 534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbtMk

    /home/roroco/.rbenv/versions/2.1.5/lib/ruby/2.1.0/net/smtp.rb:969:in `check_auth_response'
    /home/roroco/.rbenv/versions/2.1.5/lib/ruby/2.1.0/net/smtp.rb:740:in `auth_plain'
    /home/roroco/.rbenv/versions/2.1.5/lib/ruby/2.1.0/net/smtp.rb:732:in `authenticate'
    /home/roroco/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/ruby-gmail-0.3.1/lib/smtp_tls.rb:57:in `do_tls_start'
    /home/roroco/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/ruby-gmail-0.3.1/lib/smtp_tls.rb:18:in `start'
    /home/roroco/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/mail-2.6.1/lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!'
    /home/roroco/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/mail-2.6.1/lib/mail/message.rb:248:in `deliver!'
    /home/roroco/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/ruby-gmail-0.3.1/lib/gmail.rb:107:in `deliver'
    /home/roroco/Dropbox/rbs/ro_plans/ex/ex.rb:5:in `<top (required)>'

update

更新

solution: https://security.google.com/settings/u/1/security/apppasswords> generate new for mail > remember it > fill it in ruby-gmail passwd

解决方案:https: //security.google.com/settings/u/1/security/apppasswords> 为邮件生成新的 > 记住它 > 填写 ruby​​-gmail passwd

回答by Vitor

Gmail has some security features that have to be enabled/disabled 1 - Inside your gmail account go to Settings > Forwarding and POP/IMAP and enable the protocols(s) that you wish to use

Gmail 有一些必须启用/禁用的安全功能 1 - 在您的 Gmail 帐户中,转到设置 > 转发和 POP/IMAP 并启用您希望使用的协议

2 - Enable access of less secure apps https://www.google.com/settings/security/lesssecureapps

2 - 允许访问不太安全的应用程序https://www.google.com/settings/security/lesssecureapps

回答by Raj Kumar Goyal

You can check https://accounts.google.com/DisplayUnlockCaptchaas well. You can unblock application url by unlocking it.

您也可以查看https://accounts.google.com/DisplayUnlockCaptcha。您可以通过解锁来解锁应用程序 url。

回答by anyvoleki

I change gem 'ruby-gmail' to gem 'gmail', it work.

我将 gem 'ruby-gmail' 更改为 gem 'gmail',它可以工作。

update: it can't fix my question, gem 'gmail' only ignore my error(raise error bug)

更新:它无法解决我的问题,gem 'gmail' 只忽略我的错误(引发错误错误)