vendor/rails/actionmailer/lib/action_mailer/base.rb in radiant-0.9.1 vs vendor/rails/actionmailer/lib/action_mailer/base.rb in radiant-1.0.0.rc1
- old
+ new
@@ -193,11 +193,44 @@
# a.body = generate_your_pdf_here()
# end
# end
# end
#
+ # = Multipart Emails with Attachments
#
+ # Multipart emails that also have attachments can be created by nesting a "multipart/alternative" part
+ # within an email that has its content type set to "multipart/mixed". This would also need two templates
+ # in place within +app/views/mailer+ called "welcome_email.text.html.erb" and "welcome_email.text.plain.erb"
+ #
+ # class ApplicationMailer < ActionMailer::Base
+ # def signup_notification(recipient)
+ # recipients recipient.email_address_with_name
+ # subject "New account information"
+ # from "system@example.com"
+ # content_type "multipart/mixed"
+ #
+ # part "multipart/alternative" do |alternative|
+ #
+ # alternative.part "text/html" do |html|
+ # html.body = render_message("welcome_email.text.html", :message => "<h1>HTML content</h1>")
+ # end
+ #
+ # alternative.part "text/plain" do |plain|
+ # plain.body = render_message("welcome_email.text.plain", :message => "text content")
+ # end
+ #
+ # end
+ #
+ # attachment :content_type => "image/png",
+ # :body => File.read(File.join(RAILS_ROOT, 'public/images/rails.png'))
+ #
+ # attachment "application/pdf" do |a|
+ # a.body = File.read('/Users/mikel/Code/mail/spec/fixtures/attachments/test.pdf')
+ # end
+ # end
+ # end
+ #
# = Configuration options
#
# These options are specified on the class level, like <tt>ActionMailer::Base.template_root = "/my/templates"</tt>
#
# * <tt>template_root</tt> - Determines the base from which template references will be made.
@@ -276,10 +309,10 @@
cattr_accessor :sendmail_settings
@@raise_delivery_errors = true
cattr_accessor :raise_delivery_errors
- superclass_delegating_accessor :delivery_method
+ class_attribute :delivery_method
self.delivery_method = :smtp
@@perform_deliveries = true
cattr_accessor :perform_deliveries