Permalink
Browse files

Tidied blog mailer

  • Loading branch information...
1 parent 69b8caa commit 5efd494a1448cbfbbd516fa80d5acc8825a5c783 @awagener awagener committed with unixcharles Jun 15, 2010
Showing with 21 additions and 10 deletions.
  1. +18 −5 app/models/blog_mailer.rb
  2. +3 −5 app/views/blog_mailer/notification.html.erb
@@ -3,20 +3,33 @@ class BlogMailer < ActionMailer::Base
def notification(comment, request)
subject "New comment on #{comment.blog.title}"
recipients BlogSetting.notification_email
- from "\"#{RefinerySetting[:site_name]}\" <no-reply@#{request.domain(RefinerySetting.find_or_set(:tld_length, 1))}>"
+ from from_address(request)
sent_on Time.now
body :comment => comment
end
def confirmation(comment, request)
- site_domain = request.domain(RefinerySetting.find_or_set(:tld_length, 1))
- subject "#{RefinerySetting[:site_name]} - comment confirmation"
+ subject "#{site_name} - comment confirmation"
recipients comment.email
- from "\"#{RefinerySetting[:site_name]}\" <no-reply@#{request.domain(RefinerySetting.find_or_set(:tld_length, 1))}>"
+ from from_address(request)
sent_on Time.now
content_type "text/html"
body :comment => comment,
- :site_domain => request.domain(RefinerySetting.find_or_set(:tld_length, 1))
+ :site_domain => site_domain(request)
+ end
+
+ protected
+
+ def from_address(request)
+ "\"#{site_name}\" <no-reply@#{site_domain(request)}>"
+ end
+
+ def site_domain(request)
+ @domain ||= request.domain(RefinerySetting.find_or_set(:tld_length, 1))
+ end
+
+ def site_name
+ RefinerySetting[:site_name]
end
end
@@ -1,17 +1,15 @@
Hi there,
-You have just had your blog post commented on.
+You have just received a comment on your post '<%= @comment.blog.title %>'.
---- blog post starts ---
+--- comment starts ---
Name: <%= @comment.name %>
Title: <%= @comment.title %>
Comment:
<%= @comment.body %>
---- blog post ends ---
+--- comment ends ---
Kind Regards,
Your Website.
-
-P.S. All your inquiries are stored in the "Inquiries" section of Refinery should you ever want to view it later there.

0 comments on commit 5efd494

Please sign in to comment.