app/models/mail_notify.rb in parlement-0.6 vs app/models/mail_notify.rb in parlement-0.7

- old
+ new

@@ -21,9 +21,32 @@ + ">" # Try to render the element as html body :elt => elt + templates = Dir.glob("#{template_path}/#{@template}.*") + templates.each do |path| + # TODO: don't hardcode rhtml|rxml + basename = File.basename(path) + next unless md = /^([^\.]+)\.([^\.]+\.[^\+]+)\.(rhtml|rxml)$/.match(basename) + template_name = basename + content_type = md.captures[1].gsub('.', '/') + @parts << ActionMailer::Part.new(:content_type => content_type, + :disposition => "inline", :charset => charset, + :body => render_message(template_name, @body)) + end + unless @parts.empty? + @content_type = "multipart/alternative" + @parts = sort_parts(@parts, @implicit_parts_order) + end + + elt.attachments.each { |att| + attachment(att.content_type ? att.content_type : "") { |a| + a.filename = att.file.gsub /^.*public.*\//, '' + a.body = File.read(att.file) + } + } + # This is the essential of a mailing list, you reply to the mailing list, # where every body sends their mail. # This very mail can be a mailing list all by itself... @headers['Reply-to'] = "#{ml.id}@#{ActionMailer::Base.server_settings[:domain]}"