diff --git a/app/models/mailer.rb b/app/models/mailer.rb index d18394c..0115386 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -48,6 +48,16 @@ class Mailer < ActionMailer::Base body :issue => issue, :issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue) render_multipart('issue_add', body) + + unless Setting.plain_text_mail? + issue.attachments.each do |attachment| + part :content_type => `file -ib #{attachment.diskfile}`.gsub(/\n/, ""), + :body => File.read(attachment.diskfile), + :disposition => 'attachment; filename=' + attachment.filename + ';', + :headers => { 'Content-Id' => attachment.filename }, + :transfer_encoding => 'base64' + end + end end # Builds a tmail object used to email recipients of the edited issue. @@ -76,6 +86,18 @@ class Mailer < ActionMailer::Base :issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue, :anchor => "change-#{journal.id}") render_multipart('issue_edit', body) + + unless Setting.plain_text_mail? + journal.details.each do |detail| + if detail.property == 'attachment' && attachment = Attachment.find_by_id(detail.prop_key) + part :content_type => `file -ib #{attachment.diskfile}`.gsub(/\n/, ""), + :body => File.read(attachment.diskfile), + :disposition => 'attachment; filename=' + attachment.filename + ';', + :headers => { 'Content-Id' => attachment.filename }, + :transfer_encoding => 'base64' + end + end + end end def reminder(user, issues, days)