Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Use configured FROM email address when sending emails

Roland Geiderc4aeab9cc301
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 59ed0bb27..679d9908c 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -49,7 +49,7 @@ Upgrade steps from 1.9:
* `#368`_, `#379`_, `#426`_ (thanks `@austin-leung`_), `#499`_, `#505`_, `#504`_,
`#511`_, `#516`_, `#522`_, `#554`_ and `#560`_ (thanks `@sandilsranasinghe`_),
`#564`_, `#565`_, `#615`_, `#560`_ (thanks `@bradsk88`_), `#617`_ (thanks `@Sidrah-Madiha`_),
- `#636`_, `#640`_, `#642`_, `#648`_
+ `#636`_, `#640`_, `#642`_, `#648`_, `#650`_
🧰 Maintenance:
@@ -128,6 +128,7 @@ Upgrade steps from 1.9:
.. _#640: https://github.com/wger-project/wger/issues/640
.. _#642: https://github.com/wger-project/wger/issues/642
.. _#648: https://github.com/wger-project/wger/issues/648
+.. _#650: https://github.com/wger-project/wger/issues/650
diff --git a/extras/docker/compose/dev.env b/extras/docker/compose/dev.env
index 242e51a39..c2e9210a7 100644
--- a/extras/docker/compose/dev.env
+++ b/extras/docker/compose/dev.env
@@ -22,6 +22,7 @@ DJANGO_MEDIA_ROOT=/home/wger/media
# Application
ALLOW_REGISTRATION = True
ALLOW_GUEST_USERS = True
[email protected] # The 'from' email used when sending emails
# Others
DJANGO_DEBUG=True
diff --git a/extras/docker/development/settings.py b/extras/docker/development/settings.py
index e17484cd9..9338fbf94 100644
--- a/extras/docker/development/settings.py
+++ b/extras/docker/development/settings.py
@@ -76,6 +76,7 @@ if os.environ.get("ENABLE_EMAIL"):
# Sender address used for sent emails
WGER_SETTINGS['EMAIL_FROM'] = f'wger Workout Manager <{os.environ.get("FROM_EMAIL")}>'
+DEFAULT_FROM_EMAIL = WGER_SETTINGS['EMAIL_FROM']
# Management
if os.environ.get("ALLOW_REGISTRATION") == 'False':
diff --git a/wger/core/views/user.py b/wger/core/views/user.py
index 6642f7bf6..f1361ed6f 100644
--- a/wger/core/views/user.py
+++ b/wger/core/views/user.py
@@ -590,6 +590,7 @@ class WgerPasswordResetView(PasswordResetView):
template_name = 'form.html'
email_template_name = 'registration/password_reset_email.html'
success_url = reverse_lazy('core:user:password_reset_done')
+ from_email = settings.WGER_SETTINGS['EMAIL_FROM']
def get_form(self, form_class=None):
form = super(WgerPasswordResetView, self).get_form(form_class)
diff --git a/wger/mailer/management/commands/send-mass-emails.py b/wger/mailer/management/commands/send-mass-emails.py
index 8e7c3ed87..9b1a81d56 100644
--- a/wger/mailer/management/commands/send-mass-emails.py
+++ b/wger/mailer/management/commands/send-mass-emails.py
@@ -36,7 +36,7 @@ class Command(BaseCommand):
for email in CronEntry.objects.all()[:100]:
mail.send_mail(email.log.subject,
email.log.body,
- settings.DEFAULT_FROM_EMAIL,
+ settings.WGER_SETTINGS['EMAIL_FROM'],
[email.email],
fail_silently=True)
email.delete()
diff --git a/wger/mailer/views/gym.py b/wger/mailer/views/gym.py
index a7dd902fe..2877fb22c 100644
--- a/wger/mailer/views/gym.py
+++ b/wger/mailer/views/gym.py
@@ -112,7 +112,7 @@ class EmailListFormPreview(FormPreview):
if admin.email:
mail.send_mail(form.cleaned_data['subject'],
form.cleaned_data['body'],
- settings.DEFAULT_FROM_EMAIL,
+ settings.WGER_SETTINGS['EMAIL_FROM'],
[admin.email],
fail_silently=False)
return context
diff --git a/wger/settings.tpl b/wger/settings.tpl
index e70362b2e..a2c686647 100644
--- a/wger/settings.tpl
+++ b/wger/settings.tpl
@@ -64,6 +64,7 @@ if DEBUG:
# Sender address used for sent emails
WGER_SETTINGS['EMAIL_FROM'] = 'wger Workout Manager <[email protected]>'
+DEFAULT_FROM_EMAIL = WGER_SETTINGS['EMAIL_FROM']
# Your twitter handle, if you have one for this instance.
#WGER_SETTINGS['TWITTER'] = ''