0

私は自分のウェブサイトの連絡フォームでレール上で作業しています。私は電子メールを送信し、件名が記載された電子メールを受信しました。しかし、本体は空白です。ここにコードがあります:

contact_mailer.rb

class ContactMailer < ActionMailer::Base
  default from: "noreplay@hybrid-tech.net"
  default to:   "info@hybrid-tech.net"

  def new_message(contact_message)
    @contact_message = contact_message
    mail(subject: "Send it from Hybrid Tech Website - #{@contact_message.subject} ")
  end
end

景色

contact_email.html.erb

<!DOCTYPE html>
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
  </head>
  <body>
    <h1>Name: <%= @contact_message.name %></h1>
    <h1>E-Mail: <%= @contact_message.email %></h1>
    <p>
      Message: <%= @contact_message.body %><br/>
    </p>
  </body>
</html>

誰かがここで何が問題なのかを知っていて、考えていますか?

ありがとう!!!

4

1 に答える 1

1

名前をに変更contact_email.html.erbnew_message.html.erbます。

ビューには、メーラーのアクションと同じ名前を付ける必要があります。

于 2012-09-06T16:36:25.757 に答える