minpham-com / medusa-plugin-smtp

6 stars 3 forks source link

Add Customer Events #2

Open diegonc opened 1 year ago

diegonc commented 1 year ago

Customer events are not yet handled by this plugin. Thus, a reset password event from a store customer cannot trigger an email to be sent.

This is the list of customer events:

I was about to add them in a PR but found two ways this package uses to subscribe to events.

There's the following way in src/subscribers/order.js:

class OrderSubscriber {
  constructor({ notificationService }) {
    this.notificationService_ = notificationService

    this.notificationService_.subscribe("order.shipment_created", "smtp")

And then there is the one at src/subscribers/user.js:

class UserSubscriber {
  constructor({ smtpService, eventBusService }) {
    this.smtpService_ = smtpService

    this.eventBus_ = eventBusService

    this.eventBus_.subscribe("user.password_reset", async (data) => {
      await this.smtpService_.sendNotification(

Which one is the most up to date/desired?

diegonc commented 1 year ago

Well, it seems the former no longer works with recent medusa versions

alsherif-khalaf commented 6 months ago

Well, it seems the former no longer works with recent medusa versions Hi diegonc any suggestion to make it work or another way to use SMTP ?