2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
2013-06-12 15:59:58 +00:00
|
|
|
|
2015-08-28 00:53:14 +00:00
|
|
|
class Channel::Driver::MailStdin < Channel::EmailParser
|
2015-09-02 07:14:48 +00:00
|
|
|
|
|
|
|
=begin
|
|
|
|
|
|
|
|
process emails from STDIN
|
|
|
|
|
|
|
|
cat /path/to/mail.eml | rails r 'Channel::Driver::MailStdin.new'
|
|
|
|
|
2016-02-07 13:00:29 +00:00
|
|
|
e. g.
|
|
|
|
|
2018-06-05 03:28:12 +00:00
|
|
|
cat test/data/mail/mail001.box | rails r 'Channel::Driver::MailStdin.new'
|
2016-02-07 13:00:29 +00:00
|
|
|
|
2016-10-29 18:27:30 +00:00
|
|
|
e. g. if you want to trust on mail headers
|
|
|
|
|
2018-06-05 03:28:12 +00:00
|
|
|
cat test/data/mail/mail001.box | rails r 'Channel::Driver::MailStdin.new(trusted: true)'
|
2016-10-29 18:27:30 +00:00
|
|
|
|
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))'
|
|
|
|
|
2015-09-02 07:14:48 +00:00
|
|
|
=end
|
|
|
|
|
2020-09-30 09:07:01 +00:00
|
|
|
def initialize(params = {}) # rubocop:disable Lint/MissingSuper
|
2015-05-04 19:34:04 +00:00
|
|
|
Rails.logger.info 'read main from STDIN'
|
2012-11-07 22:18:31 +00:00
|
|
|
|
|
|
|
msg = ARGF.read
|
|
|
|
|
2016-10-29 18:27:30 +00:00
|
|
|
process(params, msg)
|
2012-11-07 22:18:31 +00:00
|
|
|
end
|
2013-06-12 15:59:58 +00:00
|
|
|
end
|