Loss of attachments while fetching emails from IMAP (GMail)
|Target version:||Candidate for next major release|
When new issue is created by email fetched from gmail via redmine:email:receive_imap, attachments are ignored.
Steps to reproduce:
- send email with attachment to redmine GMail account.
- execute rake redmine:email:receive_imap RAILS_ENV=production
- go to issue list of the project
Expected: new issue was created with file attached to it. Mail in GMail box was cleared.
In fact: new issue is created but without attachments. Message is left in mailbox.
#5 Updated by Moritz D about 6 years ago
I'm using 3.2.0
same problem as issue author
"new issue is created but without attachments. Message is marked read and left in mailbox"
applying redmine_attachments_save.diff did not help. should it resolve the problem? is noone else using email attachments?
thank you in advance
#9 Updated by Janeks Kamerovskis almost 5 years ago
I have the same problem with:
Redmine version 3.3.3.stable
Ruby version 2.3.1-p112 (2016-04-26) [x86_64-linux-gnu]
Rails version 220.127.116.11
Database adapter Mysql2
Where could I look / dig to find the solution?
#11 Updated by Yuichi HARADA almost 2 years ago
- File 10721-fixed.patch added
- The process to add the attachments is performed after
- Attachments are added directly to
issue#attachments, but originally it must go through
#saved_attachmentsdefined in acts_as_attachable.
I created a patch.
#13 Updated by Wicky Hu about 1 year ago
I tested 10721-fixed.path in latest 4.2.0, it seems only working for one attachment.
If there are two or more attachments in email, then only the first attachment shown in notification mail.
I guess the reason is new issue email is created when first attachment added and issue saved, after that, remaining attachments added and saved.
#17 Updated by Wicky Hu about 1 year ago
I think to change the add_attachments method could solve the issue, basically to change << to build, not yet fully tested, but seems working.
# obj.attachments << Attachment.create(:container => obj, # :file => attachment.body.decoded, # :filename => attachment.filename, # :author => user, # :content_type => attachment.mime_type) obj.attachments.build(:container => obj, :file => attachment.body.decoded, :filename => attachment.filename, :author => user, :content_type => attachment.mime_type)