奇怪的错误(红宝石邮件

时间:2011-12-09 19:50:34

标签: ruby email sinatra contact-form

我正在尝试在我的网站上放置一个简单的联系表单。在应用程序文件中,我有,

post '/contact' do
  name = params[:name]
  mail = params[:mail]
  inquirykind = params [:inquirykind]
  body = params[:body]

  Mail.defaults.do
    delivery_method :smtp, { :address => "smtp.gmail.com",
                             :port => 587,    
                         :user_name => "user@example.com",
                         :password => "password",
                         :authentication => 'plain',
                         :enable_starttls_auto => true }
  end

  mail = Mail.new do
    from     '#{mail}'
    to       'user@example.com'
    subject  '#{inquirykind} from #{name}'
    body     '#{body}'
  end

  redirect '/thanks'

  mail.deliver!

end

我尝试运行该应用并立即收到错误

app.rb:47: syntax error, unexpected keyword_end, expecting $end

我以某种方式混淆了这个简单的形式,并且不知道足够的Ruby来修复它。

提前致谢!

0 个答案:

没有答案