forked from microapidev/email-microapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa7ee67
commit ff26e7d
Showing
14 changed files
with
39 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
from rest_framework import serializers | ||
from .models import Newsletter | ||
|
||
class NewsletterSerializers(serializers.ModelSerializer): | ||
class NewsletterSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Newsletter | ||
fields = ('subject', 'body', 'from_email', 'to_email') | ||
|
||
|
||
class CustomSerializers(serializers.ModelSerializer): | ||
class CustomSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Newsletter | ||
fields = ('subject', 'from_email', 'to_email') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
from celery import shared_task | ||
from django.shortcuts import render | ||
from sendgrid import SendGridAPIClient | ||
from send_email_microservice.settings import SENDGRID_API_KEY | ||
from sendgrid.helpers.mail import * | ||
from time import sleep | ||
from django.core.mail import send_mail | ||
|
||
|
||
@shared_task | ||
def send_email(): | ||
sleep(10) | ||
send_mail(subject, body, from_email, [to_email]) | ||
return send_mail | ||
@shared_task() | ||
def send_mail(sender, recipient, subject, content): | ||
|
||
@shared_task | ||
def send_custom_mail(): | ||
sleep(10) | ||
message = EmailMultiAlternatives(subject, newsletter_mail, from_email, [to_email]) | ||
return message | ||
sg = SendGridAPIClient(api_key=SENDGRID_API_KEY) | ||
|
||
mail = Mail(sender, recipient, subject, content) | ||
|
||
send = sg.send(mail) | ||
|
||
return send |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters