@@ -94,7 +94,6 @@ class EmailService: to=settings.ERROR_EMAIL_RECIPIENTS, # reply_to=(error.author.email,), ) - mail.content_subtype = 'html' for img in report.attachments: mail.attach(img.name, img.read(), img.content_type) img.close() @@ -1,12 +1,5 @@ - - -
- -Пользователь {{ email }} сообщил об ошибке:
-{{ report_text }}
-Скриншоты ошибки (если пользователь их приложил) - во вложении
- - +Пользователь {{ email }} сообщил об ошибке: + +{{ report_text }} + +Скриншоты ошибки (если пользователь их приложил) - во вложении @@ -22,7 +22,7 @@ class SendErrorReportEmailAPIView(APIView): data = serializer.validated_data report = Report( message=data['report_text'], - attachments=[File(file.name, file.file, file.content_type, file.size) for file in data['images']] + attachments=[File(file.name, file.file, file.content_type, file.size) for file in data.get('images', [])] ) EmailService(request.user).send_error_email(report) return Response({'detail': 'error report sent'}, status=status.HTTP_201_CREATED)