trabajo-afectivo/app/models/channel/driver/mail_stdin.rb

33 lines
800 B
Ruby
Raw Normal View History

# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
2015-08-28 00:53:14 +00:00
class Channel::Driver::MailStdin < Channel::EmailParser
=begin
process emails from STDIN
cat /path/to/mail.eml | rails r 'Channel::Driver::MailStdin.new'
e. g.
cat test/data/mail/mail001.box | rails r 'Channel::Driver::MailStdin.new'
e. g. if you want to trust on mail headers
cat test/data/mail/mail001.box | rails r 'Channel::Driver::MailStdin.new(trusted: true)'
2019-04-05 16:12:10 +00:00
e. g. if you want to process this mail by using a certain inbound channel
cat test/data/mail/mail001.box | rails r 'Channel::Driver::MailStdin.new(Channel.find(14))'
=end
def initialize(params = {}) # rubocop:disable Lint/MissingSuper
2015-05-04 19:34:04 +00:00
Rails.logger.info 'read main from STDIN'
msg = ARGF.read
process(params, msg)
end
end