Net::SMTPAuthenticationError at/contacts 535-5.7.8用户名和密码不被接受Sinatra Ruby
当我在Sinatra的帮助下发送一个简单表单时,它会显示以下错误: Net::SMTPAuthenticationError at/contacts 535-5.7.8用户名和密码不被接受Ruby Sinatra 程序的哪些版本:Net::SMTPAuthenticationError at/contacts 535-5.7.8用户名和密码不被接受Sinatra Ruby,ruby,email,gmail,sinatra,pony,Ruby,Email,Gmail,Sinatra,Pony,当我在Sinatra的帮助下发送一个简单表单时,它会显示以下错误: Net::SMTPAuthenticationError at/contacts 535-5.7.8用户名和密码不被接受Ruby Sinatra 程序的哪些版本: 操作系统:Windows 7/64 Ruby版本:Ruby 2.6.3p62(2019-04-16修订版67580)[x64-mingw32] 捆绑包中包含的宝石: 后端口(3.15.0) 捆扎机(2.0.2) 邮件(2.7.1) 迷你mime(1.0.2) 多
- 操作系统:Windows 7/64
- Ruby版本:Ruby 2.6.3p62(2019-04-16修订版67580)[x64-mingw32]
- 后端口(3.15.0)
- 捆扎机(2.0.2)
- 邮件(2.7.1)
- 迷你mime(1.0.2)
- 多线程json(1.14.1)
- 小马(1.13.1)
- 机架(1.5.2)
- 机架保护(1.5.1)
- 机架测试(1.1.0)
- 西纳特拉(1.4.4)
- sinatra contrib(1.4.7)
- 倾斜(1.4.1)
# app.rb
require 'rubygems'
require 'sinatra'
require 'sinatra/reloader'
require "pony"
get '/' do
erb "Hello! <a href=\"https://github.com/bootstrap-ruby/sinatra-bootstrap\">Original</a> pattern has been modified for <a href=\"http://rubyschool.us/\">Ruby School</a>"
end
get "/contacts" do
erb :contacts
end
post "/contacts" do
login = params[:login]
message = params[:message]
Pony.mail({
:to => '***1***@gmail.com', # real mail 1
:from => '***2***@gmail.com', # real mail 2
:via => :smtp,
:subject => "New message from user: #{login}",
:body => "#{message}",
:via_options => {
:address => 'smtp.gmail.com',
:port => '587',
:enable_starttls_auto => true,
:user_name => '***2***@gmail.com', # real mail 2
:password => '**********',
:authentication => :plain, # :plain, :login, :cram_md5, no auth by default
:domain => "gmail.com" # the HELO domain provided by the client to the server
# :openssl_verify_mode => 'none'
}
})
erb :contacts
end
注意:下面的第一个提示是搜索、研究和跟踪您发现的内容,以及“535-5.7.8用户名和密码不被接受”的提示可能重复。
<body>
<h2> Feedback </h2>
<form action="/contacts" method="POST">
<div class="form-group">
<label>Your name:</label>
<input name="username" type="text" class="form-control" placeholder="Your name">
<label for="comment">Text of the appeal:</label>
<textarea name="message" class="form-control" rows="5" placeholder="Text of the appeal"></textarea>
</div>
<button type="submit" class="btn btn-primary">Send:</button>
</form>
C:/Ruby26-x64/lib/ruby/2.6.0/net/smtp.rb in check_auth_response
raise SMTPAuthenticationError, res.message
C:/Ruby26-x64/lib/ruby/2.6.0/net/smtp.rb in auth_plain
check_auth_response res