mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-21 04:11:06 -05:00
Update : new sender validation endpoint and process
This commit is contained in:
@@ -29,7 +29,7 @@ class DjrillBackend(BaseEmailBackend):
|
|||||||
"url to your settings.py")
|
"url to your settings.py")
|
||||||
|
|
||||||
self.api_action = self.api_url + "/messages/send.json"
|
self.api_action = self.api_url + "/messages/send.json"
|
||||||
self.api_verify = self.api_url + "/users/verify-sender.json"
|
self.api_verify = self.api_url + "/users/ping.json"
|
||||||
|
|
||||||
def open(self, sender):
|
def open(self, sender):
|
||||||
"""
|
"""
|
||||||
@@ -37,11 +37,9 @@ class DjrillBackend(BaseEmailBackend):
|
|||||||
self.connection = None
|
self.connection = None
|
||||||
|
|
||||||
valid_sender = requests.post(
|
valid_sender = requests.post(
|
||||||
self.api_verify, data={"key": self.api_key, "email": sender})
|
self.api_verify, data={"key": self.api_key})
|
||||||
|
|
||||||
if valid_sender.status_code == 200:
|
if valid_sender.status_code == 200:
|
||||||
data = json.loads(valid_sender.content)
|
|
||||||
if data["is_enabled"]:
|
|
||||||
self.connection = True
|
self.connection = True
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user