Sinatra 1.2.6 / Haml 3.1.2 および Pony
を指す「引数エラーの数が間違っています(1に対して0)」が表示されます
シナトラ/base.rb
def haml(template, options={}, locals={})
render :haml, template, options, locals
end
:html_body => (haml :html_email) をポニーに送信しています
どんな助けでも大歓迎です!
M.
あなたのコードはSinatra1.2.6、Haml 3.1.3、Pony1.3で動作するようです。(haml:test)の代わりにhaml(:test)を使用しますが
test.rb:
require 'rubygems'
require 'sinatra'
require 'pony'
require 'haml'
set :views, Proc.new { root }
get '/send' do
options = {
:to => 'user@gmail.com',
:from => 'user@gmail.com',
:subject => 'Test',
:body => 'Test Text',
:html_body => (haml :test),
:via => :smtp,
:via_options => {
:address => 'smtp.gmail.com',
:port => 587,
:enable_starttls_auto => true,
:user_name => 'login',
:password => 'password',
:authentication => :plain,
:domain => 'HELO'
}
}
Pony.mail(options)
end
test.haml:
!!!
%html
%head
%meta{ :content => "text/html; charset=utf-8", :"http-equiv" => "Content-Type" }
%title Test
%body
%h1 Test
%p Test content