message send email

This commit is contained in:
wanglinchun 2013-12-13 11:31:12 +08:00
parent dcc47ae989
commit 10177618f0
5 changed files with 17 additions and 9 deletions

View File

@ -1,7 +1,7 @@
# Added by young
class JournalsForMessageObserver < ActiveRecord::Observer
def after_create(journal_for_message)
Mailer.journals_for_message_add(User.current, journal_for_message).deliver
def after_create(journals_for_message)
Mailer.journals_for_message_add(User.current, journals_for_message).deliver
end
end

View File

@ -29,12 +29,14 @@ class Mailer < ActionMailer::Base
# Builds a Mail::Message object used to email recipients of the added journals for message.
#
# def journals_for_message_add(user, journals_for_message)
# @user = User.current
# @url = url_for(:controller => 'users', :action => 'user_newfeedback')
# mail :to => user.mail,
# :subject => "hello"
# end
def journals_for_message_add(user, journals_for_message)
@user = User.current
@mail = journals_for_message.jour
@message = journals_for_message.notes
@url = url_for(:controller => 'users', :action => 'user_newfeedback', :id => @mail)
mail :to => @mail.mail,
:subject => "You have a new message"
end
# Builds a Mail::Message object used to email recipients of the added issue.
#

View File

@ -0,0 +1,3 @@
<h1><%= link_to("hello", @url) %></h1>
<em><%=h @user %></em>
<div><%= @message %></div>

View File

@ -0,0 +1,3 @@
<%= link_to("hello", @url) %>
<%=h @user %>
<%= @message %>

View File

@ -23,7 +23,7 @@ module RedmineApp
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Activate observers that should always be running.
config.active_record.observers = :message_observer, :issue_observer, :journal_observer, :news_observer, :document_observer, :wiki_content_observer, :comment_observer
config.active_record.observers = :journals_for_message_observer, :message_observer, :issue_observer, :journal_observer, :news_observer, :document_observer, :wiki_content_observer, :comment_observer
config.active_record.store_full_sti_class = true
config.active_record.default_timezone = :local