primatejs / primate

Web framework focused on flexibility and developer freedom
https://primatejs.com
MIT License
211 stars 9 forks source link

add `@primate/mail` #133

Closed terrablue closed 1 month ago

terrablue commented 5 months ago

In a store file, say stores/Mailchimp.js:

import mail from "@primate/mail";
import env from "rcompat/env";

export default mail({
  provider: "mailchimp",
  secret: env.MAILCHIMP_API_KEY,
  options: {
     server: env.MAILCHIMP_SERVER_PREFIX,
  },
});

Then in a route, say routes/register.js:

export default {
  post(request) {
    // Handle registration
    /* ... */
   // send email
   request.store.Mailchimp.send(user.email, { ... });
  },
});
ralyodio commented 5 months ago

should add Mailgun and SendGrid too. that's the one I use.

terrablue commented 1 month ago

https://github.com/primatejs/primate/issues/165