|
|
@@ -7,6 +7,8 @@ from django.template.loader import get_template
|
|
|
from django.template import Context
|
|
|
from django.template import engines, TemplateSyntaxError
|
|
|
|
|
|
+from django.conf import settings
|
|
|
+
|
|
|
from uuid import uuid4,UUID
|
|
|
import json
|
|
|
import re
|
|
|
@@ -159,12 +161,15 @@ class ServizioMail:
|
|
|
if self.json:
|
|
|
msg.attach_alternative(self.json,'text/json')
|
|
|
|
|
|
- try:
|
|
|
- msg.send()
|
|
|
- print('messaggio inviato')
|
|
|
- except ConnectionRefusedError as cre:
|
|
|
- print('impossibile inviare mail',cre)
|
|
|
-
|
|
|
+ if settings.EMAIL_ENABLED:
|
|
|
+ print('configurazione: email_enabled True')
|
|
|
+ try:
|
|
|
+ msg.send()
|
|
|
+ print('messaggio inviato')
|
|
|
+ except ConnectionRefusedError as cre:
|
|
|
+ print('impossibile inviare mail',cre)
|
|
|
+ else:
|
|
|
+ print('configurazione: email_enabled False')
|
|
|
####################
|
|
|
# modulo comunicazioni
|
|
|
####################
|