646b / redmine_email_images Goto Github PK
View Code? Open in Web Editor NEWSend images inline in redmine email notifications.
License: Do What The F*ck You Want To Public License
Send images inline in redmine email notifications.
License: Do What The F*ck You Want To Public License
Hi,
would it be possible to convert images pasted via ckeditor? They are base64 encoded lik this:
<img alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA4QAAAFKCAIAAADKUQaBAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAP+lSURBVHhepP1p32zb
But most mail clients blocks this kind of embedded images.
J.
Hello!
This plugin is great! Though it doesn´t work with my installation. The mails still contains no images as attachments. The installation runs without errors and the plugin is show in the plugins view.
Here the information of my installation:
Environment:
Redmine version 3.0.2.devel
Ruby version 2.1.2-p95 (2014-05-08) [x86_64-linux-gnu]
Rails version 4.2.1
Environment production
Database adapter PostgreSQL
SCM:
Git 2.4.0
Filesystem
Redmine plugins:
advanced_roadmap_v2 2.4.0
redmine_author_notification_emails 1.0.0
redmine_checklists 3.1.1
redmine_documents 1.0.0
redmine_email_images 0.1.1
redmine_emojibutton 0.3.0
redmine_revision_branches 0.2.0
Hava you any idea what causes the problem? Thanks a lot
Eric
hi,
Thanks for the simple plugin, it's quite useful.
There is a very small issue. There is an extra empty line at the very top of the message.
Even, in addition it's there even when there is no inline image.
Hi,
In order to make this plugin work on windows, I had to change the following line at email_send_patch.rb
:
FROM:
related.attachments.inline[image_name] = File.read(attachment_object.diskfile)
TO:
related.attachments.inline[image_name] = IO.binread(attachment_object.diskfile)
Thanks for this plugin :)
Спасибо за модуль, очень не хватало этого в redmine. Но нашел один баг, который воспроизводится только на письмах с "multipart/mixed".
Обычные уведомления от Redmine представляют собой multipart/alternative с text/plain и text/html внутри. И код патча работает ничего не ломает, хотя и почем зря пересобирает письмо, даже если не найдено ни одного тэга img в письме.
А вот c multipart/mixed все хуже. Например, если письмо в multipart/mixed, внутри которого multipart/alternative (ради text/plain+text/html) и любой файл-вложение. В итоге "пересборка" блоков все ломает и вместо письма получается каша.
Не уверен, что мой вариант решения корректен, но у меня работает вот такой кусок кода:
if message.content_type.start_with?("multipart/alternative")
message.parts.clear
message.parts << text_part
message.parts << related
elsif message.content_type.start_with?("multipart/mixed")
message.parts.each do |msgpart|
next unless msgpart.content_type.start_with?("multipart/alternative")
next unless msgpart.html_part.cid == html_part.cid
new_msgpart = Mail::Part.new
new_msgpart.content_type = 'multipart/alternative'
new_msgpart.parts << text_part
new_msgpart.parts << related
end
end
Ну и все это завернуто в if с проверкой found_images (счетчик, накручивается внутри блока с поиском по FIND_IMG_SRC_PATTERN).
When I send an attachment via e-mail, or via "New Issue" tab, the e-mail notification is sent, but without the attachmemnt.
huanghanzhen@ee-200:~/rubyworkspace/function_tracker/redmine-3.0.3$ rake redmine:email:receive_pop3 RAILS_ENV="production" host=fg-pop.chthibox.net username=xxxx password=xxxx folder=Inbox project=test allow_override=project --trace
** Invoke redmine:email:receive_pop3 (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute redmine:email:receive_pop3
undefined method `charset' for nil:NilClass
/home/huanghanzhen/rubyworkspace/function_tracker/redmine-3.0.3/plugins/redmine_email_images/lib/email_receive_inline_patch.rb:43:in `decode_part_body'
/home/huanghanzhen/rubyworkspace/function_tracker/redmine-3.0.3/plugins/redmine_email_images/lib/email_receive_inline_patch.rb:28:in `decoded_html'
/home/huanghanzhen/rubyworkspace/function_tracker/redmine-3.0.3/plugins/redmine_email_images/lib/email_receive_inline_patch.rb:15:in `add_attachments_with_remove_inline_images'
/home/huanghanzhen/rubyworkspace/function_tracker/redmine-3.0.3/app/models/mail_handler.rb:206:in `receive_issue'
/home/huanghanzhen/rubyworkspace/function_tracker/redmine-3.0.3/app/models/mail_handler.rb:182:in `dispatch_to_default'
/home/huanghanzhen/rubyworkspace/function_tracker/redmine-3.0.3/app/models/mail_handler.rb:167:in `dispatch'
/home/huanghanzhen/rubyworkspace/function_tracker/redmine-3.0.3/app/models/mail_handler.rb:142:in `receive'
/var/lib/gems/2.1.0/gems/actionmailer-4.2.1/lib/action_mailer/base.rb:530:in `block in receive'
/var/lib/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `block in instrument'
/var/lib/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/var/lib/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `instrument'
/var/lib/gems/2.1.0/gems/actionmailer-4.2.1/lib/action_mailer/base.rb:527:in `receive'
/home/huanghanzhen/rubyworkspace/function_tracker/redmine-3.0.3/app/models/mail_handler.rb:46:in `receive'
/home/huanghanzhen/rubyworkspace/function_tracker/redmine-3.0.3/app/models/mail_handler.rb:51:in `safe_receive'
/home/huanghanzhen/rubyworkspace/function_tracker/redmine-3.0.3/lib/redmine/pop3.rb:51:in `block (2 levels) in check'
/usr/lib/ruby/2.1.0/net/pop.rb:665:in `each'
/usr/lib/ruby/2.1.0/net/pop.rb:665:in `each_mail'
/home/huanghanzhen/rubyworkspace/function_tracker/redmine-3.0.3/lib/redmine/pop3.rb:48:in `block in check'
/usr/lib/ruby/2.1.0/net/pop.rb:531:in `start'
/home/huanghanzhen/rubyworkspace/function_tracker/redmine-3.0.3/lib/redmine/pop3.rb:43:in `check'
/home/huanghanzhen/rubyworkspace/function_tracker/redmine-3.0.3/lib/tasks/email.rake:161:in `block (4 levels) in <top (required)>'
/home/huanghanzhen/rubyworkspace/function_tracker/redmine-3.0.3/app/models/mailer.rb:383:in `with_synched_deliveries'
/home/huanghanzhen/rubyworkspace/function_tracker/redmine-3.0.3/lib/tasks/email.rake:160:in `block (3 levels) in <top (required)>'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/var/lib/gems/2.1.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'
Im trying to install the plugin but I get the following:
C:\Bitnami\redmine-2.5.2-2\apps\redmine\htdocs>rake redmine:plugins:migrate RAIL
S_ENV=production --trace
** Invoke redmine:plugins:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
cannot load such file -- htmlentities
And my gem list:
actionmailer (4.1.5)
actionpack (4.1.5)
actionview (4.1.5)
activemodel (4.1.5)
activerecord (4.1.5)
activerecord-deprecated_finders (1.0.3)
activesupport (4.1.5)
akami (1.2.0)
ansi (1.4.3)
arel (5.0.1.20140414130214)
atomic (1.1.14)
aws-sdk (1.8.3.1)
bigdecimal (1.2.0)
builder (3.1.4)
bundler (1.7.0)
coffee-rails (4.0.1)
coffee-script (2.2.0)
coffee-script-source (1.6.2)
crack (0.3.1)
daemons (1.1.8)
diff-lcs (1.1.3)
erubis (2.7.0)
eventmachine (1.0.0)
execjs (1.4.0)
gyoku (0.4.6)
hike (1.2.3)
hoe (3.0.6)
hpricot (0.8.5)
htmlentities (4.3.3)
httparty (0.8.3)
i18n (0.6.9)
iconv (1.0.3)
io-console (0.4.2)
jbuilder (2.0.7, 1.4.2)
journey (1.0.4)
jquery-rails (3.0.4)
json (1.8.0, 1.7.7)
mail (2.5.4)
mime-types (1.23)
mini_magick (3.4)
mini_portile (0.6.0)
minitest (5.3.3, 4.3.2)
multi_json (1.3.6)
multi_xml (0.5.1)
mustache (0.99.4)
mysql2 (0.3.16 x86-mingw32, 0.2.18)
nokogiri (1.6.2.1 x86-mingw32, 1.5.9 x86-mingw32)
pg (0.16.0 x86-mingw32)
polyglot (0.3.3)
psych (2.0.0)
rack (1.5.2)
rack-cache (1.2)
rack-mount (0.8.3)
rack-ssl (1.3.2)
rack-test (0.6.2)
rails (4.1.5)
railties (4.1.5)
rake (10.1.1, 10.1.0, 0.9.6, 0.9.2.2)
rake-compiler (0.8.1)
rdiscount (1.6.8)
rdoc (4.0.0, 3.12.2)
rmagick (2.13.2 x86-mingw32)
ronn (0.7.3)
rspec (2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.2)
rspec-mocks (2.11.1)
rubygems-update (2.3.0)
rvm (1.11.3.5)
sass (3.2.9)
sass-rails (4.0.3, 4.0.1)
sdoc (0.4.0, 0.3.20)
spring (1.1.2)
sprockets (2.10.0, 2.4.5, 2.2.1)
sprockets-rails (2.0.1)
sqlite3 (1.3.8 x86-mingw32)
sqlite3-ruby (1.3.2 x86-mingw32)
subexec (0.2.2)
test-unit (2.0.0.0)
thin (1.5.1)
thor (0.18.1)
thread_safe (0.1.0)
tilt (1.4.1)
treetop (1.4.14)
turbolinks (1.2.0)
turn (0.9.6)
tzinfo (1.1.0)
tzinfo-data (1.2014.2)
uglifier (2.1.1)
uuidtools (2.1.3)
Совместно с плагином CKEditor (version 1.0.20 ) не работает
Using Redmine 3.2.1 with this plugin. While sendig updates from tickets via webinterface, everything's fine and inline images are displayed.
But when I try to send/update an issue via mail I get this error and the mail stucks in the queue, even if there is no inline (or any other) image attached but (in this case) a pdf document:
mailqueue:
(temporary failure. Command output: Failed to contact your Redmine server (500). Posting to http://localhost:80/mail_handler... Response received: 500)
redmine log:
NoMethodError (undefined method `charset' for nil:NilClass):
plugins/redmine_email_images/lib/email_receive_inline_patch.rb:43:in `decode_part_body'
plugins/redmine_email_images/lib/email_receive_inline_patch.rb:28:in `decoded_html'
plugins/redmine_email_images/lib/email_receive_inline_patch.rb:15:in `add_attachments_with_remove_inline_images'
app/models/mail_handler.rb:243:in `receive_issue_reply'
app/models/mail_handler.rb:166:in `dispatch'
app/models/mail_handler.rb:150:in `receive'
app/models/mail_handler.rb:49:in `block in receive'
app/models/mail_handler.rb:46:in `receive'
app/controllers/mail_handler_controller.rb:29:in `index'
is that a bug or is something wrong with my database (encoding, whatever ?)
some further details about my environment (running on Debian Jessie 8.4):
Environment:
Redmine version 3.2.1.stable
Ruby version 2.1.5-p273 (2014-11-13) [x86_64-linux-gnu]
Rails version 4.2.5.2
Environment production
Database adapter Mysql2
SCM:
Git 2.1.4
Filesystem
Redmine plugins:
due_date_reminder 0.3.2
periodictask 2.0.0
recurring_tasks 2.0.0-pre
redmine_checklists 3.1.3
redmine_email_images 0.1.1
redmine_ics_export 3.0.1.dev
redmine_issue_completion 0.0.2
redmine_lightbox2 0.2.5
redmine_local_avatars 1.0.0
redmine_mail_reminder 3.0.0.0001
redmine_monitoring_controlling 0.1.1
redmine_silencer 0.4.1
redmine_stats 0.0.3
redmine_target_client_project 0.1.0
redmine_timesheet_plugin 0.7.0
vault 0.0.5
Regards
Peter
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.