Skip to content
Browse files

Merge branch 'release-3-0'

  • Loading branch information...
2 parents 4f1ddc6 + 360a2a6 commit be40d3ba3ee0b354127bedd53340dacc7e6bea83 @jrom jrom committed
Showing with 9 additions and 2 deletions.
  1. +9 −2 app/models/emailer/incoming.rb
View
11 app/models/emailer/incoming.rb
@@ -201,9 +201,16 @@ def process_incoming(email)
@user = User.find_by_email from
raise UserNotFoundError.new(email, "Invalid user '#{email.from.first}'") unless @user
raise NotProjectMemberError.new(email, "User does not belong to project") unless @user.projects.include? @project
-
+
+ # Get the body in multipart emails as well
+ if email.respond_to? :parts
+ parts = email.parts.select{|p| p.content_type.include?('text/')}
+ @body = parts.any? ? parts.collect(&:decoded).join("\n") : email.body
+ else
+ @body = email.body
+ end
#strip any remaining html tags (after strip_responses) from the body
- @body = strip_responses(email.body).strip_tags.to_s.strip
+ @body = strip_responses(@body).strip_tags.to_s.strip
@subject = email.subject.to_s.gsub(REPLY_REGEX, "").strip
@files = email.attachments || []

0 comments on commit be40d3b

Please sign in to comment.
Something went wrong with that request. Please try again.