所以邮寄的方法有效。我试过从控制台调用它。问题是内容变量似乎是空的。所以当我从控制台[heroku]调用ContactMailer.contact_email时,它可以工作。我不确定为什么= c
我也试过做params [:post] [:email] ..无济于事:C
def contact_email #now how to pass email and content
email = params[:email]
content = params[:content]
ContactMailer.contact_email(email, content).deliver
redirect_to contact_path, notice: 'Message sent'
end
<%= form_tag(contact_email_path) do %>
<div class="form-group">
<%= label_tag 'email', 'Email' %>
<%= text_field_tag 'email', nil, class: 'form-control', placeholder: 'Your Email Address' %>
</div>
<div class="form-group">
<%= label_tag 'content', 'Content' %>
<%= text_area_tag 'content', nil, class: 'form-control', rows: 4, placeholder: 'Content' %>
</div>
<%= submit_tag nil, class: 'btn btn-default btn-about pull-right' %>
<% end %>
match '/contact_email', to: 'pages#contact_email', via: 'post'
2014-04-23T22:25:25.169161+00:00 heroku[router]: at=info method=POST path=/contact_email host=hs-staging.herokuapp.com request_id=6f3753a7-10a0-4354-86b0-81893afefc52 fwd="108.23.126.184" dyno=web.1 connect=4ms service=2276ms status=302 bytes=659
2014-04-23T22:25:25.430981+00:00 heroku[router]: at=info method=GET path=/contact host=hs-staging.herokuapp.com request_id=1c5081eb-eb5d-48eb-9d58-8c699d12f6a3 fwd="108.23.126.184" dyno=web.1 connect=1ms service=45ms status=200 bytes=9356
答案 0 :(得分:0)
所以我认为heroku需要.text.erb电子邮件视图,即使发送给的电子邮件客户端没有使用它...