Skip to content

Commit

Permalink
Print a debug message on failed mail
Browse files Browse the repository at this point in the history
  • Loading branch information
fr0gRIP committed Jul 19, 2016
1 parent cd3d39e commit 70ad754
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
8 changes: 5 additions & 3 deletions middleware/vigilateMiddleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ def process_response(self, request, response):
mail_dest = q["user"].email

if mail_dest:
mail.send_mail(mail_subject, mail_content, 'vigilate_2017@epitech.eu',
[mail_dest], fail_silently=True)

try:
mail.send_mail(mail_subject, mail_content, 'vigilate_2017@epitech.eu',
[mail_dest], fail_silently=True)
except ConnectionRefusedError as e:
print ("MAIL ERROR : ", e)
sms_content = ""
sms_dest = ""
if len(thread_locals.queue[User.SMS]) == 1:
Expand Down
18 changes: 10 additions & 8 deletions vigilate_backend/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ def get_queryset(self):

def perform_create(self, serializer):
new_user = serializer.save()

send_mail(
'Vigilate account created',
'Hello, your vigilate account has just been created.\nYou can now connect to the website with your mail address and your password.',
'vigilate_2017@epitech.eu',
[new_user.email],
fail_silently=True,
)
try:
send_mail(
'Vigilate account created',
'Hello, your vigilate account has just been created.\nYou can now connect to the website with your mail address and your password.',
'vigilate_2017@epitech.eu',
[new_user.email],
fail_silently=True,
)
except ConnectionRefusedError as e:
print ("MAIL ERROR : ", e)

class UserProgramsViewSet(viewsets.ModelViewSet):
"""View for users programs
Expand Down

0 comments on commit 70ad754

Please sign in to comment.