File: //usr/local/rvm/gems/ruby-2.7.4/doc/actionmailbox-6.1.4.1/ri/ActionMailbox/Base/cdesc-Base.ri
U:RDoc::NormalClass[iI" Base:ETI"ActionMailbox::Base;TI"Object;To:RDoc::Markup::Document:@parts[o;;[o:RDoc::Markup::Paragraph;[I"lThe base class for all application mailboxes. Not intended to be inherited from directly. Inherit from ;TI"h+ApplicationMailbox+ instead, as that's where the app-specific routing is configured. This routing ;TI"(is specified in the following ways:;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim;[I"4class ApplicationMailbox < ActionMailbox::Base
;TI"a # Any of the recipients of the mail (whether to, cc, bcc) are matched against the regexp.
;TI"( routing /^replies@/i => :replies
;TI"
;TI"l # Any of the recipients of the mail (whether to, cc, bcc) needs to be an exact match for the string.
;TI"+ routing "help@example.com" => :help
;TI"
;TI"l # Any callable (proc, lambda, etc) object is passed the inbound_email record and is a match if true.
;TI"\ routing ->(inbound_email) { inbound_email.mail.to.size > 2 } => :multiple_recipients
;TI"
;TI"q # Any object responding to #match? is called with the inbound_email record as an argument. Match if true.
;TI", routing CustomAddress.new => :custom
;TI"
;TI"b # Any inbound_email that has not been already matched will be sent to the BackstopMailbox.
;TI"! routing :all => :backstop
;TI" end
;T:@format0o; ;[ I"lApplication mailboxes need to overwrite the +#process+ method, which is invoked by the framework after ;TI"hcallbacks have been run. The callbacks available are: +before_processing+, +after_processing+, and ;TI"k+around_processing+. The primary use case is ensure certain preconditions to processing are fulfilled ;TI")using +before_processing+ callbacks.;T@o; ;[
I"bIf a precondition fails to be met, you can halt the processing using the +#bounced!+ method, ;TI"jwhich will silently prevent any further processing, but not actually send out any bounce notice. You ;TI"kcan also pair this behavior with the invocation of an Action Mailer class responsible for sending out ;TI"pan actual bounce email. This is done using the +#bounce_with+ method, which takes the mail object returned ;TI")by an Action Mailer method, like so:;T@o;;[I"0class ForwardsMailbox < ApplicationMailbox
;TI"2 before_processing :ensure_sender_is_a_user
;TI"
;TI" private
;TI"% def ensure_sender_is_a_user
;TI"8 unless User.exist?(email_address: mail.from)
;TI"C bounce_with UserRequiredMailer.missing(inbound_email)
;TI" end
;TI"
end
;TI" end
;T;0o; ;[
I"gDuring the processing of the inbound email, the status will be tracked. Before processing begins, ;TI"fthe email will normally have the +pending+ status. Once processing begins, just before callbacks ;TI"mand the +#process+ method is called, the status is changed to +processing+. If processing is allowed to ;TI"ocomplete, the status is changed to +delivered+. If a bounce is triggered, then +bounced+. If an unhandled ;TI",exception is bubbled up, then +failed+.;T@o; ;[I"ZExceptions can be handled at the class level using the familiar +Rescuable+ approach:;T@o;;[I"0class ForwardsMailbox < ApplicationMailbox
;TI"F rescue_from(ApplicationSpecificVerificationError) { bounced! }
;TI"end;T;0:
@fileI"lib/action_mailbox/base.rb;T:0@omit_headings_from_table_of_contents_below0;
0;0[[
I"inbound_email;TI"R;T:publicFI"lib/action_mailbox/base.rb;T[ [[I"ActiveSupport::Rescuable;To;;[ ;
@N;0@S[[I"
class;T[[;[[I"new;T@S[I"receive;T@S[:protected[ [:private[ [I"
instance;T[[;[[I"bounce_with;T@S[I"process;T@S[;[ [;[[I""track_status_of_inbound_email;T@S[ [U:RDoc::Context::Section[i 0o;;[ ;
0;0[@NI"ActionMailbox;TcRDoc::NormalModule