diff app/models/mailer.rb @ 313:862e47cc1e09 live

Merge from branch "bug_97"
author Chris Cannam
date Mon, 28 Mar 2011 18:04:17 +0100
parents 76c548e4e6e4
children 350acce374a2
line wrap: on
line diff
--- a/app/models/mailer.rb	Mon Mar 28 17:50:50 2011 +0100
+++ b/app/models/mailer.rb	Mon Mar 28 18:04:17 2011 +0100
@@ -31,6 +31,27 @@
     h = h.to_s.gsub(%r{\/.*$}, '') unless Redmine::Utils.relative_url_root.blank?
     { :host => h, :protocol => Setting.protocol }
   end
+
+
+
+  # Builds a tmail object used to email the specified user that he was added to a project
+  #
+  # Example:
+  #   add_to_project(user) => tmail object
+  #   Mailer.deliver_add_to_project(user) => sends an email to the registered user
+  def added_to_project(member, project)
+
+    user = User.find(member.user_id)
+
+    set_language_if_valid user.language
+    recipients user.mail
+    subject l(:mail_subject_added_to_project, Setting.app_title)
+    body :project_url => url_for(:controller => 'projects', :action => 'show', :id => project.id),
+        :project_name => project.name
+    render_multipart('added_to_project', body)
+  end
+
+
   
   # Builds a tmail object used to email recipients of the added issue.
   #
@@ -440,3 +461,7 @@
     end
   end
 end
+
+
+
+