backdrop-contrib / backup_migrate

Port of the Drupal backup_migrate module to Backdrop
GNU General Public License v2.0
7 stars 14 forks source link

Backup email notification from address is webhost address rather than site address #151

Open izmeez opened 7 months ago

izmeez commented 7 months ago

As in the title, the email notification of backup from address is the webhost address rather than the web site address. Is there a way to configure this or can it default to using the site email address?

argiepiano commented 7 months ago

That's not correct. The email is sent to the address configured for your site at admin/config/system/site-information.

That address can be customized in the Advanced Options at admin/config/system/backup_migrate/export/advanced, but the default will always match the address configured in your site.

Closing, as it works as designed. If you find this is not the case, reopen and please provide details.

izmeez commented 7 months ago

It is not an issue with the "To" address but the "From" address. When the Contact form is used it shows the "From" address correctly as the one specified in /admin/config/system/site-information. However, notifications from backup_migrate go to the address specified in the Advanced settings but show the "From" address as the webhost default. This is not a critical issue, but would be nice to configure. I'll try to take a look at the code to see what I can learn.

argiepiano commented 7 months ago

Got it. I'll check this later. Reopening.

izmeez commented 7 months ago

I took a look to see if I could figure this out. But, unfortunately I could not.

I looked at the core contact module that sends contact email using the site_mail address as the from address and at line 247 of contact.module implements hook_mail.

And I looked at the backup_migrate module that sends email using the webhost address, similar to what a cron script does. In backup_migrate.module on line 1886 hook_mail is invoked. But, I can't figure out how the site_mail can be added to the $params.

izmeez commented 7 months ago

I see drupal's backup_migrate using the following syntax: $mail->from = variable_get('site_mail', ini_get('sendmail_from'));

But, I have no idea what Backdrop needs.

argiepiano commented 6 months ago

OK, I've looked into this a bit. The line of code you pasted above has nothing to do with the notification email. That line is part of a function that is used when emailing the actual backup zip file - not for notifications.

In order for the notification to use the site's email address, we need to avoid using the php function mail() in backup_migrate_filter_statusnotify::backup_succeed() and ::backup_failed() and instead use backdrop_mail() (and implement hook_mail() in backup_migrate.module).

I'll get to this at some point...

jenlampton commented 6 months ago

The email is sent to the address configured for your site at admin/config/system/site-information.

That sounds like a pretty serious bug. Sending email TO the FROM address? This is usually set to no-reply@ so sending emails there wiil do nothing. I'll open a separate issue for that!

edit: see https://github.com/backdrop-contrib/backup_migrate/issues/159

izmeez commented 4 months ago

@jenlampton It is not sending email TO the FROM address? It is sending from the webhost default address not from the site default address. This can be confusing if there are multiple sites on the same webhost.