Sha256: 775e7c2d16be9bf4b50074f9614f235e5198e92fac87f7faea07ba48b0470b70

Contents?: true

Size: 1.32 KB

Versions: 10

Compression:

Stored size: 1.32 KB

Contents

module Proclaim
	class SubscriptionMailer < ActionMailer::Base
		default from: Proclaim.mailer_sender || default_params[:from] || "from@example.com"

		def welcome_email(subscription)
			@subscription = subscription

			message = Premailer.new(render_to_string, with_html_string: true, base_url: root_url)
			base_url = root_url.gsub(/\A.*:\/\//, '').gsub(/\A(.*?)\/*\z/, '\1')

			mail to: @subscription.email, subject: "Welcome to #{base_url}!" do |format|
				format.html { message.to_inline_css }
				format.text { message.to_plain_text }
			end
		end

		def new_comment_notification_email(subscription, comment)
			@subscription = subscription
			@comment = comment

			message = Premailer.new(render_to_string, with_html_string: true, base_url: root_url)

			mail to: @subscription.email,
			     subject: "New Comment On \"#{@comment.post.title}\"" do |format|
				format.html { message.to_inline_css }
				format.text { message.to_plain_text }
			end
		end

		def new_post_notification_email(subscription, post)
			@subscription = subscription
			@post = post

			message = Premailer.new(render_to_string, with_html_string: true, base_url: root_url)

			mail to: @subscription.email,
			     subject: "New Post: #{@post.title}" do |format|
				format.html { message.to_inline_css }
				format.text { message.to_plain_text }
			end
		end
	end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
proclaim-0.5.6 app/mailers/proclaim/subscription_mailer.rb
proclaim-0.5.5 app/mailers/proclaim/subscription_mailer.rb
proclaim-0.5.3 app/mailers/proclaim/subscription_mailer.rb
proclaim-0.5.2 app/mailers/proclaim/subscription_mailer.rb
proclaim-0.5.1 app/mailers/proclaim/subscription_mailer.rb
proclaim-0.5.0 app/mailers/proclaim/subscription_mailer.rb
proclaim-0.4.0 app/mailers/proclaim/subscription_mailer.rb
proclaim-0.3.1 app/mailers/proclaim/subscription_mailer.rb
proclaim-0.3.0 app/mailers/proclaim/subscription_mailer.rb
proclaim-0.2.4 app/mailers/proclaim/subscription_mailer.rb