No notification mail is sent if list of BCC mails is empty

Created on 5 August 2023, over 1 year ago
Updated 12 June 2024, 6 months ago

Problem/Motivation

Steps to reproduce

Configure module as follows

  • Populate "Default To Address" with single email address
  • Do not populate any email into "Populate Email Id's to whom the notification is to be sent, add comma separated emails in case of multiple recipients" and do not check any user category in "Select roles" below this input box

Expected
A single notification is sent to address in "Default To Address" on content change

Actual
No email is sent

This is caused by following lines in AdminContentNotificationService.php

      if (strlen($recepients_emails) === 0) {
        return;
      }

The $recepients_emails holds all BCC emails (based on "Populate Email Id's to whom the notification is to be sent, add comma separated emails in case of multiple recipients", but as there is no email there, it is empty because of no list of bcc emails configured and no user category to sent notification to is selected. The $to is the only email address that is populated, but it is not tested here.

Because of above test not including $to field, it is assumed that there is no recipient at all and sending of notification is stopped.

Proposed resolution

Change this code to test $to as well

      if (strlen($recepients_emails) === 0 && empty($to)) {
        return;
      }
🐛 Bug report
Status

RTBC

Version

4.1

Component

Code

Created by

🇸🇰Slovakia matus grinvalsky

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @matus grinvalsky
  • First commit to issue fork.
  • @uttam opened merge request.
  • with the proposed resolution given in the issue the problem was fixed, the mail is sending to default address if no other email sending options are select and raised a merge request.

  • Status changed to Needs review about 1 year ago
  • Status changed to RTBC about 1 year ago
  • 🇮🇳India arisen Goa

    Reviewed the MR, the changes look good.
    Applied the patch from the MR. It applies cleanly.

    Checking patch src/AdminContentNotificationService.php...
    Applied patch src/AdminContentNotificationService.php cleanly.
    

    Verified the notification process without BCC emails after applying the patch. The email gets sent to the Default address.
    Moving to RTBC.

  • @maintainers Can this issue be closed(fixed) now ?
    please check

  • Hi @maintainers,
    Any updates on this. Can this is fixed now?

Production build 0.71.5 2024