So the method from the mailer works. I have tried calling it from the console. The issue is that the content variable appears to be empty. So when I call ContactMailer.contact_email from the console [heroku] it works. I am not sure why =c
I have also tried doing params[:post][:email] .. to no avail :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
所以我想heroku需要一个.text.erb电子邮件视图,即使发送到的电子邮件客户端没有使用它也是如此。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.