Project

General

Profile

Feature #3760 » redmine-3760-1.4.3.patch

Patch for sending email attachments on 1.4.3 - Brian Crowell, 2012-12-10 16:16

View differences:

app/models/mailer.rb
48 48
    body :issue => issue,
49 49
         :issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue)
50 50
    render_multipart('issue_add', body)
51

  
52
    unless Setting.plain_text_mail?
53
      issue.attachments.each do |attachment|
54
        part :content_type => `file -ib #{attachment.diskfile}`.gsub(/\n/, ""),
55
             :body => File.read(attachment.diskfile),
56
             :disposition => 'attachment; filename=' + attachment.filename + ';',
57
             :headers => { 'Content-Id' => attachment.filename },
58
             :transfer_encoding => 'base64'
59
      end
60
    end
51 61
  end
52 62

  
53 63
  # Builds a tmail object used to email recipients of the edited issue.
......
76 86
         :issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue, :anchor => "change-#{journal.id}")
77 87

  
78 88
    render_multipart('issue_edit', body)
89

  
90
    unless Setting.plain_text_mail?
91
      journal.details.each do |detail|
92
        if detail.property == 'attachment' && attachment = Attachment.find_by_id(detail.prop_key)
93
          part :content_type => `file -ib #{attachment.diskfile}`.gsub(/\n/, ""),
94
               :body => File.read(attachment.diskfile),
95
               :disposition => 'attachment; filename=' + attachment.filename + ';',
96
               :headers => { 'Content-Id' => attachment.filename },
97
               :transfer_encoding => 'base64'
98
        end
99
      end
100
    end
79 101
  end
80 102

  
81 103
  def reminder(user, issues, days)
(3-3/6)