Problem/Motivation

The value 'dummy' is set by default as the email for the Update Manager - Available updates policy (admin/config/system/mailer)
This is not obvious until an error is generated in watchdog about invalid email address format.

Steps to reproduce

  1. Import mailer policy for the update module
  2. Drupal tries to send 'Available updates' email.

Proposed resolution

In UpdateEmailBuilder::import() change line 88 like this:

    if ($mail_notification && ($mail_notification != 'dummy)) {

Remaining tasks

User interface changes

API changes

Data model changes

Comments

Jons created an issue. See original summary.

maulik1992’s picture

Assigned: Unassigned » maulik1992

I will check this

maulik1992’s picture

@jons can you please elaborate PHP version , I am not able to enable php 8.1 and D10 this module , errors throwing .

maulik1992’s picture

Assigned: maulik1992 » Unassigned
jons’s picture

@maulik1992 I was using php 7.4, Drupal 9.3.15

adamps’s picture

Issue summary: View changes

Thanks for the report. The problem comes after importing config. I updated the IS with a proposed fix. I someone creates a patch then I would commit it.

immaculatexavier’s picture

Status: Active » Needs review
StatusFileSize
new899 bytes

I've attached the patch in accordance with the proposed resolution.

jons’s picture

Hi @AdamPS
I think it's better and more consistent to set the default as <site> as you do with the policy: User - 'Admin (user awaiting approval)'
and remove the use of 'dummy' altogether

wells’s picture

StatusFileSize
new696 bytes

Agree with #8 -- it's unclear from the (in code) documentation why "dummy" is used here and <site> seems like a saner default. Attaching an alternative patch for that.

adamps’s picture

Thanks @immaculatexavier

it's unclear from the (in code) documentation why "dummy" is used here and seems like a saner default

I agree this is a bit confusing and it would help to have better comments (I can add them when I commit). In fact the value "dummy" is not a default. It is a placeholder value that should never be used. Once we fix this bug with #7, it would correctly not be used.

There is a problem with #9:

  1. Install existing site using an older mailer, e.g. swiftmailer.
  2. Disable update notifications.
  3. Installs this module and imports config.
  4. Actual: Update notifications now go to the site address.
  5. Expected: Update notifications are still disabled.

Therefore please can @Jons and/or @wells test the patch in #7 and mark as RTBC?

wells’s picture

@AdamPS — I see. In my case this value is used in the resulting configuration. Do you have a recommendation for how to provide a fix as part of the patch as well?

adamps’s picture

First apply the patch then re-import config for update manager (/admin/config/system/mailer/import).

wells’s picture

I have tested the patch in #7 and it works as expected on first import -- no policy is added if update notifications are disabled.

However if I already have a policy using the "dummy" address because I imported policies without this fix, applying the patch in #7 and re-importing has no effect -- the "Update Manager" policy with "dummy" address is still there.

adamps’s picture

Status: Needs review » Reviewed & tested by the community

I have tested the patch in #7 and it works as expected on first import -- no policy is added if update notifications are disabled.

Great.

applying the patch in #7 and re-importing has no effect

Thanks - that's a shame. I checked the code and I agree, there's no way it will delete the existing policy, and it would be dangerous if it did.

Sites that already hit this bug can just delete the wrong policy. Sorry I realise this is slightly tedious, but the module is still alpha, so there can be one or two things like this.

wells’s picture

@AdamPS OK -- fair to take that approach given we are still in alpha here. Perhaps a line in the release notes about the issue and solution would be minimally useful? E.g. --

This version fixes a bug in the Symfony Mailer BC submodule that would create an "Update Manager" manager policy with an invalid "dummy" email address causing an error to be logged: Error sending email: Email "dummy" does not comply with addr-spec of RFC 2822..

To resolve this issue simply delete the imported "Update Manager" policy (if update notifications are undesired) or set the policy address to a real email address. See #3292384: Import of update config causes dummy address for details.

adamps’s picture

Title: Change value of update.settings email override » Import of update config causes dummy address
Status: Reviewed & tested by the community » Needs review
StatusFileSize
new1.84 KB

Yes good idea about the release note - I will try to remember😃.

adamps’s picture

adamps’s picture

Status: Needs review » Fixed

adamps’s picture

Status: Fixed » Needs review
StatusFileSize
new1.17 KB

Unfortunately I've just spotted there is still a bug - the import code will now never run because notification.emails is always overridden to dummy.

Here is a new patch - please can someone test again? NB You need to update to the latest dev release before applying the patch.

wells’s picture

Status: Needs review » Needs work

@AdamPS it seems this still isn't working right. I tested using a fresh Drupal 9 install with the default notifications configuration (configured to email to "admin@example.com") --

With 1.0.0-alpha10 the resulting policy has a To address of "dummy".
With dev-1.x d4761e7 the resulting policy has no To address.
With dev-1.x d4761e7 + #20 patch the resulting policy still has no To address.

Resulting config for 1.0.0-alpha10:

uuid: b841f9b9-9c47-490a-8e28-8fb4895dafd2
langcode: en
status: true
dependencies:
  module:
    - update
_core:
  default_config_hash: JOcNPf-ezI7vLCxZg4K9wpGqKYj6vMHlfsmhx_WGbTM
id: update.status_notify
configuration:
  email_to:
    addresses:
      -
        value: dummy
        display: ''
  email_body:
    content:
      value: |-
        <p>You need to take action to secure your server {{ site_name }}.</p>
        <ul>
        {% for message in messages %}
          <li>{{ message }}</li>
        {% endfor %}
        </ul>

        <p>See the <a href="{{ update_status }}">available updates</a> page for more information.
        {% if update_manager %}
          You can automatically install your updates using the <a href="{{ update_manager }}">Update manager</a>.
        {% endif %}
        You can <a href="{{ update_settings }}">change your settings</a> for what update notifications you receive.</p>
      format: email_html
  email_subject:
    value: 'New release(s) available for {{ site_name }}'

Resulting config for both the d4761e7 and d4761e7 + #20 patch:

uuid: 5cd38db3-9c96-4c72-b10f-6781517c8b6d
langcode: en
status: true
dependencies:
  module:
    - update
_core:
  default_config_hash: JOcNPf-ezI7vLCxZg4K9wpGqKYj6vMHlfsmhx_WGbTM
id: update.status_notify
configuration:
  email_body:
    content:
      value: |-
        <p>You need to take action to secure your server {{ site_name }}.</p>
        <ul>
        {% for message in messages %}
          <li>{{ message }}</li>
        {% endfor %}
        </ul>

        <p>See the <a href="{{ update_status }}">available updates</a> page for more information.
        {% if update_manager %}
          You can automatically install your updates using the <a href="{{ update_manager }}">Update manager</a>.
        {% endif %}
        You can <a href="{{ update_settings }}">change your settings</a> for what update notifications you receive.</p>
      format: email_html
  email_subject:
    value: 'New release(s) available for {{ site_name }}'
adamps’s picture

Status: Needs work » Needs review
StatusFileSize
new1.18 KB
new870 bytes

Thanks for the testing report. I think I have spotted the problem - here is a new patch.

wells’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, @AdamPS. Patch in #22 looks good.

  • If I have an update manager notification email address configured the policy is created with a "To" element using that email address.
  • If I do not have an update manager notification email address configured no "To" element is created.

  • AdamPS committed aa7fe27 on 1.x
    Issue #3292384 by AdamPS, wells, immaculatexavier, Jons: Import of...
adamps’s picture

Status: Reviewed & tested by the community » Fixed

Thanks

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

steveoriol’s picture

Version: 1.0.0-alpha10 » 1.1.0-beta3

If some modules are not up to date and the cron must send an email to the admin to warn him,
I get the following error every 15 minutes until the modules are up to date.
Error sending email: Email "dummy" does not comply with addr-spec of RFC 2822.
I have the problem with D9.4.8 and symfony_mailer v1.1.0-beta3

[...]
OK, I found my problem, in fact I do not know why, but there was written "dummy" instead of a real email address in the field "To" on the configuration page "admin/reports/updates/settings".
now it works much better ;-)