ryssbowh/craft-emails

Conflict with Verbb Comments Plugin

Closed this issue · 5 comments

I'm using Emails in concert with the Verbb Comments plugin and it appears Emails is preventing notifications from being dispatched from the Comments plugin as Comments can no longer use Craft's System Messages. I'm using email to send a notification when an entry as added and Comments is included on those entries.

To Reproduce
Steps to reproduce the behavior:

  1. Install/Setup Emails
  2. Install/Setup Verrb Comments
  3. Make a comment using the Comments plugin with author notifications enabled.
  4. Reply back to that comment.
  5. The email will fail and the error from the Comments plugin is attached.
    comments.txt

Software:

  • Emails version: 1.4.6
  • Craft version: 3.7.67
  • Email adaptor (sendgrid etc): Mandrill

Just to chime in here after my debugging.

2023-03-06 14:42:50 [-][1][-][error][comments] Error sending element author notification: Ryssbowh\CraftEmails\services\EmailsService::getByKey(): Argument #1 ($key) must be of type string, null given, called in C:\wamp\www\milestone\vendor\ryssbowh\craft-emails\src\services\EmailerService.php on line 34

The line throwing the error - https://github.com/ryssbowh/craft-emails/blob/1.0/src/services/EmailerService.php#L34 points to the message “key” being empty. But for Comments, these are keys to system messages, like “ comments_author_notification” (see https://github.com/verbb/comments/blob/craft-4/src/Comments.php#L230)

It seems like this plugin does something odd to override the default Mailer with your own, and moves all System Messages out from Utilities to your own plugin to manage. I'm not sure if that's causing a conflict. These system messages do appear under your plugin at least. https://share.cleanshot.com/T7NqBCY6

Hi, thanks for reporting.

There's 2 issues here :

Emails not sent :
This is due to Comments plugin not using Mailer::composeFromKey() to create the email. The emails plugin should have handled this situation though, I've fixed it in 1.4.7.
So the email will take content and subject defined in the Email plugin emails, but will not override all the other settings (template, from, cc, bcc, attachements, reply to), and will not save logs.
I'll mention this to them.

Emails not appearing on the Emails plugin
That seem to happen when another plugin registers system messages when the email plugin is already installed. Not sure exactly why but I'll fix this.

I made some changes in 1.4.8 to make sure emails registered by other plugins are properly (un)installed.
Also added a "Reinstall" button in the settings to reinstall emails in case of missing/orphans, to avoid having to reinstall those 3rd party plugins.

I made some changes in 1.4.8 to make sure emails registered by other plugins are properly (un)installed. Also added a "Reinstall" button in the settings to reinstall emails in case of missing/orphans, to avoid having to reinstall those 3rd party plugins.

Thank you. That resolved the conflict with the notifications from Verbb comments, however I still can't see my system messages option under utilities.

That's "normal", the Emails plugin basically overrides the system messages, the content is managed in the Emails so it removes the utility.
You do see the Verbb notifications in the Emails section right ?