0
+ # The heart and soul of the mack-mailer package.
0
@@ -11,13 +12,17 @@ module Mack # :nodoc:
0
attr_accessor :html_body
0
attr_accessor :date_sent
0
attr_accessor :mime_version
0
+ attr_accessor :content_type
0
+ # A helper method that takes a Hash and will populate the email with the key/value pairs of that Hash.
0
def build(options = {})
0
+ # Returns the text_body of the email. If there is no text_body set it will attempt to build one using
0
+ # the text.erb template for this mailer.
0
@text_body = build_template(:text)
0
@@ -25,6 +30,8 @@ module Mack # :nodoc:
0
+ # Returns the html_body of the email. If there is no html_body set it will attempt to build one using
0
+ # the html.erb template for this mailer.
0
@html_body = build_template(:html)
0
@@ -32,10 +39,12 @@ module Mack # :nodoc:
0
+ # Returns the mime_version of the email, defaults to "1.0"
0
(@mime_version ||= "1.0")
0
+ # This will attempt to determine the content type of the email, unless one is already specified.
0
return @content_type unless @content_type.blank?
0
@@ -49,35 +58,44 @@ module Mack # :nodoc:
0
+ # Returns the date sent, defaults to Time.now
0
(@date_sent ||= Time.now)
0
+ # Returns the reply to address, defaults to the from address.
0
(@reply_to || self.from)
0
+ # Adds a Mack::Mailer::Attachment to the email.
0
+ # Raise ArgumentError if the parameter is not a Mack::Mailer::Attachment
0
raise ArgumentError.new unless file.is_a?(Mack::Mailer::Attachment)
0
+ # Returns true if there are attachments.
0
+ # Returns the attachments Array.
0
+ # Delivers the email with the configured Mack::Mailer::DeliveryHandlers class.
0
def deliver(handler = app_config.mailer.deliver_with)
0
"Mack::Mailer::DeliveryHandlers::#{handler.camelcase}".constantize.deliver(self)
0
+ # Returns all the recipients of this email.
0
[self.to, self.cc, self.bcc].flatten.compact
0
+ # Returns a ready to be delivered, encoded, version of the email.
0
def deliverable(adapter = app_config.mailer.adapter)
0
adap = "Mack::Mailer::Adapters::#{adapter.camelcase}".constantize.new(self)