我在我的應用程序中創建了一個電子郵件功能。這一切都運行良好,除了text_area
似乎不支持新行。當我添加我的文本並點擊返回鍵時,發送的電子郵件將只包含空格並且不包含新行。這是我的指數代碼:text_area沒有新的線條功能?
<h1>Send email to all users</h1>
<br />
<%= form_tag :action => 'sendmail' %>
<p><label for="email_subject">Subject</label>
<%= text_field 'email', 'subject' %></p>
<br />
<label for="email_message">Message</label>
<br />
<%= text_area(:email, :message, :cols => 20, :rows => 40) %>
<br />
<br />
<%= submit_tag "Send" %>
<%= form_tag %>
任何幫助將不勝感激
馬克
這是我的控制器:
class MailMessageController < ApplicationController
def sendmail
email = params["email"]
recipient = email["user"]
subject = email["subject"]
message = email["message"]
MailMessage.deliver_contact(recipient, subject, message)
return if request.xhr?
render :file => 'mail_message/msg.dryml'
end
def index
render :file => 'mail_message/index.html'
end
末
這是我contact.erb文件在我的意見:
<%= @message %>
<%= "\n" %>
-------
<%= "\n" %>
Please do not reply to this email.
馬克
完全同意,+1 – apneadiving
上述更新,感謝 – Mark
是多數民衆贊成在工作,感謝 – Mark