spatie / mailcoach-support

Questions and support for Mailcoach
https://mailcoach.app
31 stars 2 forks source link

Welcomes email is also sent if user is already subscribed. #255

Closed karticbedi closed 3 years ago

karticbedi commented 3 years ago

I have a custom mailable setup and whenever i try to pass same email/data to that list which is already subscribed, it sends email to them, which should not happen.

Not sure if that should be handled with a check on build method or not.

Another issue i faced is, if a list has no welcome email enabled and then if i directly goto database and specify a custom mailable, it won't work. (i cleared cache and config too, no luck)

But if i first use default welcome email of mailcoach and then specify a custom mail class in database, it works.

I'm on version 2 and haven't tested these both issues on V3, can you please check if these two has same behaviour for you?

riasvdv commented 3 years ago

I have a custom mailable setup and whenever i try to pass same email/data to that list which is already subscribed, it sends email to them, which should not happen.

I don't really understand what you mean here, could you clarify what it is you're doing exactly?

Another issue i faced is, if a list has no welcome email enabled and then if i directly goto database and specify a custom mailable, it won't work. (i cleared cache and config too, no luck) But if i first use default welcome email of mailcoach and then specify a custom mail class in database, it works.

You're probably missing some setting that has to change if you're changing values directly in the database, is there a reason you're doing this and not using the methods provided by the package?

karticbedi commented 3 years ago

Lets say we have a list called "Users" and it has welcome email enabled.

  1. John Subscribed with john@email.com
  2. John Got welcome.

All good here so far.

Now if somehow we call subscribe method on "Users" list with same email as Johnn "john@email.com"

  1. John is already subscribed and nothig happens in database.
  2. John got welcome email again (This should not happen if John is aleready Subscribed)

hope that makes it much clearer.

karticbedi commented 3 years ago

For the second issue i followed this video and added my custom class to database https://spatie.be/videos/building-mailcoach/configuring-welcome-mails

Here Feek is adding class to database directly in "welcome_mailable_class" after using followinng options

  1. Send default welcome mail
  2. Send customized welcome mail
  3. Custom class in database (he used in sequence) Which works for him in the video.

I also added my class to database directly as Freek but i didn't used default ones, my sequece is followingn.

  1. Do not send a welcome mail
  2. Custom class in database (did not worked for me)

Maybe i should use method in that case but would love to know what else is being updated otherwise.

Thanks

riasvdv commented 3 years ago

The first issue is fixed in versions 2.23.20 and 3.2.1 of laravel-mailcoach, that was indeed a case that wasn't tested yet.

Maybe i should use method in that case but would love to know what else is being updated otherwise.

send_welcome_mail should be true on your list, you should also have a welcome_mail_subject set, and then your class.