MailglassInbound.Mailbox behaviour (MailglassInbound v0.1.0)

Copy Markdown View Source

Behaviour for adopter-defined inbound mailboxes.

Phase 39 locks the public mailbox contract to one callback: process/1. The callback receives the stable %MailglassInbound.InboundMessage{} value object and must return one of the approved outcomes:

  • :accept
  • :ignore
  • {:reject, reason}
  • {:bounce, reason}

Raises, throws, and exits are execution failures handled by internal runners. They are not semantic mailbox outcomes.

Summary

Types

outcome()

@type outcome() ::
  :accept | :ignore | {:reject, outcome_reason()} | {:bounce, outcome_reason()}

outcome_reason()

@type outcome_reason() :: term()

Callbacks

process(t)

@callback process(MailglassInbound.InboundMessage.t()) :: outcome()

Functions

valid_outcome?(arg1)

@spec valid_outcome?(term()) :: boolean()