class Tina4::DevMessengerProxy

Proxy that wraps DevMailbox with the same interface as Messenger#send

def folders = ["inbox", "outbox"]

def folders        = ["inbox", "outbox"]

def inbox(**args) = @mailbox.inbox(**args)

def inbox(**args)  = @mailbox.inbox(**args)

def initialize(mailbox, **options)

def initialize(mailbox, **options)
  @mailbox = mailbox
  @from_address = options[:from_address] || ENV["TINA4_MAIL_FROM"] || ENV["SMTP_FROM"] || "dev@localhost"
  @from_name    = options[:from_name]    || ENV["TINA4_MAIL_FROM_NAME"] || ENV["SMTP_FROM_NAME"] || "Dev Mailer"
end

def read(...) = @mailbox.read(...)

def read(...)      = @mailbox.read(...)

def search(**args) = @mailbox.inbox(**args)

def search(**args) = @mailbox.inbox(**args)

def send(to:, subject:, body:, html: false, cc: [], bcc: [],

def send(to:, subject:, body:, html: false, cc: [], bcc: [],
         reply_to: nil, attachments: [], headers: {})
  @mailbox.capture(
    to: to, subject: subject, body: body, html: html,
    cc: cc, bcc: bcc, reply_to: reply_to,
    from_address: @from_address, from_name: @from_name,
    attachments: attachments
  )
end

def test_connection

def test_connection
  { success: true, message: "DevMailbox mode — no SMTP connection needed" }
end

def unread(...) = @mailbox.unread_count

def unread(...)    = @mailbox.unread_count