New email sender name and reply-to config options.
This commit is contained in:
parent
ae618fce20
commit
29dd81ba39
@ -108,14 +108,25 @@ def get_config_variables():
|
|||||||
|
|
||||||
yield ConfigVariable(
|
yield ConfigVariable(
|
||||||
name="users_email_sender",
|
name="users_email_sender",
|
||||||
default_value="noreply@example.com",
|
default_value="",
|
||||||
input_type="string",
|
input_type="string",
|
||||||
label="Email sender",
|
label="Sender name",
|
||||||
|
help_text="The sender address is defined in the OpenSlides server settings and should modified by administrator only.",
|
||||||
weight=600,
|
weight=600,
|
||||||
group="Participants",
|
group="Participants",
|
||||||
subgroup="Email",
|
subgroup="Email",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
yield ConfigVariable(
|
||||||
|
name="users_email_replyto",
|
||||||
|
default_value="",
|
||||||
|
input_type="string",
|
||||||
|
label="Reply address",
|
||||||
|
weight=601,
|
||||||
|
group="Participants",
|
||||||
|
subgroup="Email",
|
||||||
|
)
|
||||||
|
|
||||||
yield ConfigVariable(
|
yield ConfigVariable(
|
||||||
name="users_email_subject",
|
name="users_email_subject",
|
||||||
default_value="Your login for {event_name}",
|
default_value="Your login for {event_name}",
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import smtplib
|
import smtplib
|
||||||
from random import choice
|
from random import choice
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
from django.contrib.auth.hashers import make_password
|
from django.contrib.auth.hashers import make_password
|
||||||
from django.contrib.auth.models import (
|
from django.contrib.auth.models import (
|
||||||
AbstractBaseUser,
|
AbstractBaseUser,
|
||||||
@ -247,7 +248,11 @@ class User(RESTModelMixin, PermissionsMixin, AbstractBaseUser):
|
|||||||
|
|
||||||
# Create an email and send it.
|
# Create an email and send it.
|
||||||
email = mail.EmailMessage(
|
email = mail.EmailMessage(
|
||||||
subject, message, config["users_email_sender"], [self.email]
|
subject,
|
||||||
|
message,
|
||||||
|
config["users_email_sender"] + " <" + settings.DEFAULT_FROM_EMAIL + ">",
|
||||||
|
[self.email],
|
||||||
|
reply_to=[config["users_email_replyto"]],
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
count = connection.send_messages([email])
|
count = connection.send_messages([email])
|
||||||
|
@ -47,6 +47,7 @@ EMAIL_HOST = 'localhost'
|
|||||||
EMAIL_PORT = 587
|
EMAIL_PORT = 587
|
||||||
EMAIL_HOST_USER = ''
|
EMAIL_HOST_USER = ''
|
||||||
EMAIL_HOST_PASSWORD = ''
|
EMAIL_HOST_PASSWORD = ''
|
||||||
|
DEFAULT_FROM_EMAIL = 'noreply@example.com'
|
||||||
|
|
||||||
# Increasing Upload size to 100mb (default is 2.5mb)
|
# Increasing Upload size to 100mb (default is 2.5mb)
|
||||||
DATA_UPLOAD_MAX_MEMORY_SIZE = 104857600
|
DATA_UPLOAD_MAX_MEMORY_SIZE = 104857600
|
||||||
|
Loading…
Reference in New Issue
Block a user