Class: Email::Processor
- Inherits:
-
Object
- Object
- Email::Processor
- Defined in:
- lib/email/processor.rb
Instance Attribute Summary collapse
-
#receiver ⇒ Object
readonly
Returns the value of attribute receiver.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(mail, opts = {}) ⇒ Processor
constructor
A new instance of Processor.
- #process! ⇒ Object
Constructor Details
#initialize(mail, opts = {}) ⇒ Processor
Returns a new instance of Processor.
7 8 9 10 |
# File 'lib/email/processor.rb', line 7 def initialize(mail, opts = {}) @mail = mail @opts = opts end |
Instance Attribute Details
#receiver ⇒ Object (readonly)
Returns the value of attribute receiver.
5 6 7 |
# File 'lib/email/processor.rb', line 5 def receiver @receiver end |
Class Method Details
Instance Method Details
#process! ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/email/processor.rb', line 16 def process! begin @receiver = Email::Receiver.new(@mail, @opts) @receiver.process! rescue RateLimiter::LimitExceeded if @opts[:retry_on_rate_limit] Jobs.enqueue(:process_email, mail: @mail, source: @opts[:source]) else raise end rescue => e return handle_bounce(e) if @receiver&.is_bounce? log_email_process_failure(@mail, e) incoming_email = @receiver.try(:incoming_email) = handle_failure(@mail, e) if .present? (incoming_email, .body.to_s) end end end |