Forums » Development »
Receiving Outlook inline Emails - cid: to !file.name!
Added by Justas Markauskas over 4 years ago
Wanna renew old discussion. #52340
we are so close to finish this plugin.
Is there a way to use full url instead of name in "inline image"?
since redmine allows attachments with same name. But they have unique url.
i.e. instead of:
!foo.jpg!
use this:
!https://redmine.org/attachments/download/54478/foo.jpg!
at the moment bug is that: if you send new email to redmine, outlook gives same names to images. And you will get wrong images on old notes too.
Because of a bug in my Redmine (2.5.5). Outlook tends to name all embedded screenshots image001.png. So if you write more than one mail to that issue you have duplicate image001.png. The problem then is, that redmine replaces this image tags always with the last uploaded image001.png dynamically. So if you see the right image and somebody uploads another image001 then you see the wrong image.
Current patch code:
#encoding: utf-8
require_dependency 'mail_handler'
module MailHandlerPatch
def self.included(base)
base.send(:include, InstanceMethods)
base.class_eval do
alias_method_chain :plain_text_body, :notes_cleanup
end
end
module InstanceMethods
def plain_text_body_with_notes_cleanup
body = plain_text_body_without_notes_cleanup
body.gsub!(/\[cid:(\S+?)\@\S+?\]/, '!\1!')
body
end
end
end
MailHandler.send(:include, MailHandlerPatch)