Added helper method to process unprocessable mails again (Channel::EmailParser.process_unprocessable_mails).
This commit is contained in:
parent
5514023ac9
commit
402300c848
1 changed files with 20 additions and 0 deletions
|
@ -825,6 +825,26 @@ returns
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
=begin
|
||||||
|
|
||||||
|
process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
|
||||||
|
|
||||||
|
Channel::EmailParser.process_unprocessable_mails
|
||||||
|
|
||||||
|
=end
|
||||||
|
|
||||||
|
def self.process_unprocessable_mails(params = {})
|
||||||
|
path = Rails.root.join('tmp', 'unprocessable_mail')
|
||||||
|
files = []
|
||||||
|
Dir.glob("#{path}/*.eml") do |entry|
|
||||||
|
ticket, article, user, mail = Channel::EmailParser.new.process(params, IO.binread(entry))
|
||||||
|
next if ticket.blank?
|
||||||
|
files.push entry
|
||||||
|
File.delete(entry)
|
||||||
|
end
|
||||||
|
files
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
module Mail
|
module Mail
|
||||||
|
|
Loading…
Reference in a new issue