diff --git a/awsmail/tasks.py b/awsmail/tasks.py index 273f346..8d5653f 100644 --- a/awsmail/tasks.py +++ b/awsmail/tasks.py @@ -7,7 +7,7 @@ @shared_task() def send_aws_mail(subject, body, sender, recipient): - send_mail(subject, body, sender, [recipient], fail_silently=False) + send_mail(subject, body, sender, [recipient]) return send_mail() @shared_task() diff --git a/newsletter/__pycache__/urls.cpython-36.pyc b/newsletter/__pycache__/urls.cpython-36.pyc index a3d93da..511d200 100644 Binary files a/newsletter/__pycache__/urls.cpython-36.pyc and b/newsletter/__pycache__/urls.cpython-36.pyc differ diff --git a/newsletter/__pycache__/views.cpython-36.pyc b/newsletter/__pycache__/views.cpython-36.pyc index 6e7b7a9..8efa1bc 100644 Binary files a/newsletter/__pycache__/views.cpython-36.pyc and b/newsletter/__pycache__/views.cpython-36.pyc differ diff --git a/newsletter/urls.py b/newsletter/urls.py index 340f105..b30a862 100644 --- a/newsletter/urls.py +++ b/newsletter/urls.py @@ -3,7 +3,7 @@ urlpatterns = [ - path('newsletter_all/', views.DisplayAll.as_view(), name='DisplayAll'), - path('create_newsletter/', views.SendNewsletter.as_view(), name='SendEmail'), - path('custom_newsletter/', views.SendCustomMail.as_view(), name='SendCustomMail'), + # path('newsletter_all/', views.DisplayAll.as_view(), name='DisplayAll'), + # path('create_newsletter/', views.SendNewsletter.as_view(), name='SendEmail'), + # path('custom_newsletter/', views.SendCustomMail.as_view(), name='SendCustomMail'), ] diff --git a/newsletter/views.py b/newsletter/views.py index ca7fab8..99fe8a8 100644 --- a/newsletter/views.py +++ b/newsletter/views.py @@ -43,7 +43,7 @@ def post(self, request): body=request.data['body'], from_email=settings.EMAIL_HOST_USER, to_email=request.data['to_email']) - serializer = NewsletterSerializers(data=request.data) + serializer = NewsletterSerializer(data=request.data) if serializer.is_valid(): validated_data = serializer.validated_data @@ -78,10 +78,10 @@ def post(self, request): subject = serializer.validated_data.get('subject') from_email = settings.EMAIL_HOST_USER to_email = serializer.validated_data.get('to_email') - with open(settings.BASE_DIR + '/newsletters/templates/newsletter.txt') as f: + with open(settings.BASE_DIR + '/newsletter/newsletter.txt') as f: newsletter_mail = f.read() message = EmailMultiAlternatives(subject, newsletter_mail, from_email, [to_email]) - html_template = get_template('newsletter_1.html').render() + html_template = get_template('newsletter/newsletter_1.html').render() message.attach_alternative(html_template, 'text/html') message.send() return Response({'status': 'success', diff --git a/send_certificate/views.py b/send_certificate/views.py index 3c4e0d8..2014bb2 100644 --- a/send_certificate/views.py +++ b/send_certificate/views.py @@ -57,14 +57,19 @@ def post(self, request, *args, **kwargs): send_aws_mail(subject, message.as_string(), sender, recipient) return Response({ 'status': 'Successful', - 'message': 'Confirmation link successfully sent' + 'data': { + 'message': 'Confirmation link successfully sent' + } + }, status=status.HTTP_200_OK) else: send_mail(sender, recipient, subject, content) return Response({ 'status': 'Successful', - 'message': 'Confirmation link successfully sent' + 'data': { + 'message': 'Confirmation link successfully sent' + } }, status=status.HTTP_200_OK) diff --git a/send_email_microservice/settings.py b/send_email_microservice/settings.py index 88f7e78..cd49105 100644 --- a/send_email_microservice/settings.py +++ b/send_email_microservice/settings.py @@ -203,8 +203,8 @@ # Celery settings -#CELERY_BROKER_URL = 'amqp://admin:mypass@broker:5672' -CELERY_BROKER_URL = 'amqp://localhost' +CELERY_BROKER_URL = 'amqp://admin:mypass@broker:5672' +# CELERY_BROKER_URL = 'amqp://localhost' CELERY_ACCEPT_CONTENT = ['json'] CELERY_RESULT_BACKEND = 'db+sqlite:///results.sqlite' CELERY_TASK_SERIALIZER = 'json' diff --git a/send_email_microservice/urls.py b/send_email_microservice/urls.py index b451cd9..f475b4f 100644 --- a/send_email_microservice/urls.py +++ b/send_email_microservice/urls.py @@ -48,8 +48,8 @@ def get_schema(self, request=None, public=False): path('v1/', include('send_certificate.urls')), path('v1/', include('scheduler.urls')), # path('v1/', include('Greetings_mail.urls')), - path('bouncy/', include('django_bouncy.urls')), - path('v1/', include('bounce_notification.urls')), + # path('bouncy/', include('django_bouncy.urls')), + # path('v1/', include('bounce_notification.urls')), ]