Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
izmeez opened this issue Feb 8, 2024 · 8 comments

Comments

@izmeez
Copy link

izmeez commented Feb 8, 2024

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
Copy link
Collaborator

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
Copy link
Author

izmeez commented Feb 8, 2024

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
Copy link
Collaborator

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

@argiepiano argiepiano reopened this Feb 8, 2024
@izmeez
Copy link
Author

izmeez commented Feb 28, 2024

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
Copy link
Author

izmeez commented Feb 28, 2024

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
Copy link
Collaborator

argiepiano commented Mar 10, 2024

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
Copy link
Member

jenlampton commented Mar 27, 2024

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 #159

@izmeez
Copy link
Author

izmeez commented May 7, 2024

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants