luckyframework / carbon

Email library for Crystal. Testable, adapter-based, and catches bugs for you. Comes with an adapter for SendGrid.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add middleware for viewing sent emails

paulcsmith opened this issue · comments

If this is about the DevAdapter I would propose a simpler solution (at least in the interim); just log the e-mail in the console.

I did this locally to see the e-mail contents:

def deliver_now(email : Carbon::Email)
  puts email.text_body
 @@delivered_emails << email
end

I like that idea as a nice interim solution! I'm thinking DevAdapter can accept an argument so that it doesn't print in test:

Carbon::DevAdapter.new(print_emails: Lucky::Env.development?)

I'll create an issue for this

Looking at this issue, I assume by "middleware" you mean adding a way to provide http endpoints to view sent emails.

Since we recently created pulsar I'm thinking that we add events to the carbon library and then a new shard could be made with a dependency on carbon and lucky (because carbon does not depend on lucky right now and it probably shouldn't) and listens to those events and provides some nice pages.

A general purpose admin/development tool is being made with a plan to integrate with carbon. In order to do that, we need to add pulsar and events. "middleware" is not needed at this point.

Replaced by #43