vacationlabs / haskell-webapps

Proof-of-concept code for a typical webapp implemented in various Haskell libraries/frameworks
MIT License
134 stars 21 forks source link

Send mail via sendgrid #56

Closed sras closed 7 years ago

sras commented 7 years ago

Sprint 3: Find and implement solution for Transactional emails.

  1. Find a library that can send mails using SMTP.
  2. Find a library that can be used to create multipart html emails with referable embedded media content. It should also support attachments.
  3. Find a job queue that can queue any task and let the main thread continue without blocking. Use it to queue mail sending without blocking.
  4. Implement a solution that uses all the above.

Time 2 days.

saurabhnanda commented 7 years ago

We need to ensure the following:

sras commented 7 years ago

@saurabhnanda

You want to put the code that send activation email in the createTenant api function? Would't that be a bit out of scope of it's responsibility?

Isn't this something that the library should do internally and expose via an API method?

The library exposes api methods to set headers. Isn't setting specific headers trivial enough to leave those from the api? Also, I am not sure if a general api method is even possible in this case. Because if you have a mail prepared, how will you specify a particular content block in it?

saurabhnanda commented 7 years ago

You want to put the code that send activation email in the createTenant api function? Would't that be a bit out of scope of it's responsibility?

If you feel that, do the following:

saurabhnanda commented 7 years ago

The library exposes api methods to set headers. Isn't setting specific headers trivial enough to leave those from the api? Also, I am not sure if a general api method is even possible in this case. Because if you have a mail prepared, how will you specify a particular content block in it?

Why is it not possible for the library API to insert an attachment with a given CID? Or insert an attachment and return an auto-generated CID, guaranteed to be unique in context of the email?

sras commented 7 years ago

PR for mime-email library accepted at https://github.com/snoyberg/mime-mail/pull/48 and version updated at https://hackage.haskell.org/package/mime-mail-0.4.12/docs/Network-Mail-Mime.html