InboundEmail is an Active Record that keeps a reference to the raw email stored in Active Storage and tracks the status of processing. By default, incoming emails will go through the following lifecycle:
Pending: Just received by one of the ingress controllers and scheduled for routing.
Processing: During active processing, while a specific mailbox is running its process method.
Delivered: Successfully processed by the specific mailbox.
Failed: An exception was raised during the specific mailbox's execution of the
Bounced: Rejected processing by the specific mailbox and bounced to sender.
InboundEmail has reached the status of being either
bounced, it'll count as having been
#processed?. Once processed, the
InboundEmail will be scheduled for automatic incineration at a later point.
When working with an
InboundEmail, you'll usually interact with the parsed version of the source, which is available as a
inbound_email.mail.from # => 'email@example.com' inbound_email.source # Returns the full rfc822 source of the email as text
- MODULE ActionMailbox::InboundEmail::Incineratable
- MODULE ActionMailbox::InboundEmail::MessageId
- MODULE ActionMailbox::InboundEmail::Routable
# File actionmailbox/app/models/action_mailbox/inbound_email.rb, line 35 def mail @mail ||= Mail.from_source(source) end
# File actionmailbox/app/models/action_mailbox/inbound_email.rb, line 43 def processed? delivered? || failed? || bounced? end
# File actionmailbox/app/models/action_mailbox/inbound_email.rb, line 39 def source @source ||= raw_email.download end