Get first signup email through

This commit is contained in:
Aarni Halinen
2020-07-16 13:27:18 +03:00
parent f9e7c4a904
commit 39ab86fe3e
3 changed files with 21 additions and 30 deletions
+8 -17
View File
@@ -7,9 +7,6 @@ from django.utils.translation import ugettext as _
from django.db.models.signals import post_save
from django.dispatch import receiver
import logging
from smtplib import SMTPAuthenticationError
from members.models import Member, Request
from webapp.utils import send_email
@@ -20,13 +17,10 @@ def email_on_request(sender, instance, created, **kwargs):
if not settings.ENABLE_AUTOMATIC_EMAILS:
return
try:
if created:
subject = 'Test1'
message = 'Please validate your email address\r\n'
send_email(instance.email, subject, message)
except SMTPAuthenticationError:
logging.error('Failed to send email to accepted request!')
if created:
subject = 'Test1'
message = 'Please validate your email address\r\n'
send_email(instance.email, subject, message)
@receiver(post_save, sender=Member)
@@ -35,10 +29,7 @@ def email_on_accept(sender, instance, created, **kwargs):
if not settings.ENABLE_AUTOMATIC_EMAILS:
return
try:
if created:
subject = 'Test2'
message = 'Jäsenhakemuksesi on hyväksytty!!!\r\n'
send_email(instance.email, subject, message)
except SMTPAuthenticationError:
logging.error('Failed to send email to accepted member!')
if created:
subject = 'Test2'
message = 'Jäsenhakemuksesi on hyväksytty!!!\r\n'
send_email(instance.email, subject, message)