19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/inline_attachment.rb', line 19
def create_mail
got_inlines = false
related_parts = []
for_deletion = []
@parts.each_with_index do |p,i|
logger.debug "Considering #{i}"
if p.content_disposition == 'inline' && p.content_type =~ %r{^image/}i && p.[CID_NAME]
logger.debug "Just adding [#{i}] to the list\n#{p.filename}"
for_deletion << i
related_parts << p
got_inlines = true
end
if got_inlines && p.content_type =~ %r{text/html}i
@parts[i] = ActionMailer::Part.new( :content_type => "multipart/related" )
@parts[i].parts << p
related_parts.each do |rp|
@parts[i].parts << rp
end
got_inlines = false
related_parts = []
end
end
for_deletion.sort{|a,b|b<=>a}.each {|i|@parts.delete_at(i)}
ia_original_create_mail
end
|