beam-community / bamboo

Testable, composable, and adapter based Elixir email library for devs that love piping.
https://hex.pm/packages/bamboo
MIT License
1.9k stars 343 forks source link

[Proposal] Add Optional Callback for User, to load existing sent emails. #658

Open apoorv-2204 opened 10 months ago

apoorv-2204 commented 10 months ago

I would like to purpose a feature , where if dev has existing sent emails, it can be loaded too. Its helpful to debug in dev environment , where there many automated emails, with dynamic content?. As of now, if app goes through shutdown, no sent mails are set.

To achieve this once can set a callback function, to be invoked during the agent start?

image

  def start_link(opts) do
    Agent.start_link(fn ->
      case opts.load_all_sent_mails do
        nil -> []
        fx-> fx.()
      end
    end, name: __MODULE__)
  end