Commit 3fda33b6 authored by clime's avatar clime

enable setting SERVER_EMAIL from env, use DEFAULT_FROM_EMAIL for send_mail

From documentation for DEFAULT_FROM_EMAIL:

Default email address to use for various automated correspondence from the site manager(s).
This doesn’t include error messages sent to ADMINS and MANAGERS; for that, see SERVER_EMAIL.

That means it makes sense to make SERVER_EMAIL and DEFAULT_FROM_EMAIL separate settings and
not set one from another.
parent 4f06ccbb
Pipeline #946 passed with stage
in 15 minutes and 42 seconds
......@@ -57,8 +57,6 @@ BASE_URL = os.environ.get('BASE_URL', 'http://avatars.linux-kernel.at/avatar/')
LOGIN_REDIRECT_URL = reverse_lazy('profile')
MAX_LENGTH_EMAIL = 254 # http://stackoverflow.com/questions/386294
SERVER_EMAIL = 'accounts@mg.linux-kernel.at'
DEFAULT_FROM_EMAIL = SERVER_EMAIL
MAX_NUM_PHOTOS = 5
MAX_NUM_UNCONFIRMED_EMAILS = 5
......@@ -108,6 +106,7 @@ else:
}
EMAIL_BACKEND = 'anymail.backends.mailgun.EmailBackend' # pragma: no cover
SERVER_EMAIL = os.environ.get('SERVER_EMAIL', 'ivatar@mg.linux-kernel.at')
DEFAULT_FROM_EMAIL = os.environ.get('DEFAULT_FROM_EMAIL', 'ivatar@mg.linux-kernel.at')
try:
......
......@@ -31,7 +31,7 @@ from libravatar import libravatar_url
from ivatar.settings import MAX_LENGTH_EMAIL, logger
from ivatar.settings import MAX_PIXELS, AVATAR_MAX_SIZE, JPEG_QUALITY
from ivatar.settings import MAX_LENGTH_URL
from ivatar.settings import SECURE_BASE_URL, SITE_NAME, SERVER_EMAIL
from ivatar.settings import SECURE_BASE_URL, SITE_NAME, DEFAULT_FROM_EMAIL
from .gravatar import get_photo as get_gravatar_photo
......@@ -383,7 +383,7 @@ class UnconfirmedEmail(BaseAccountModel):
# if settings.DEBUG:
# print('DEBUG: %s' % link)
send_mail(
email_subject, email_body, SERVER_EMAIL,
email_subject, email_body, DEFAULT_FROM_EMAIL,
[self.email])
return True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment