diff options
author | Matthew Lemon <y@yulqen.org> | 2024-12-08 17:37:55 +0000 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-12-08 17:37:55 +0000 |
commit | f8095c75f880a099fb8f08e05a359755458ef79a (patch) | |
tree | 1a8bac72e594bba899385e5bf1d283207730aa0e /alphabetlearning/payments/views.py | |
parent | bc557f9ea2ec520533d0e697dbab8ae1539195c4 (diff) |
Uses Mailgun for production and local settings
- credentials are in the .env file
- uses the mailgun http API to send verification messages
Diffstat (limited to 'alphabetlearning/payments/views.py')
-rw-r--r-- | alphabetlearning/payments/views.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/alphabetlearning/payments/views.py b/alphabetlearning/payments/views.py index 4a65b48..5d8449d 100644 --- a/alphabetlearning/payments/views.py +++ b/alphabetlearning/payments/views.py @@ -89,15 +89,16 @@ def send_mailgun_verification( verification_url: str = None, warn=False, ): + breakpoint() if warn: warning_message = """ You are already subscribed to our list - no further action is required. """ requests.post( - "https://api.mailgun.net/v3/sandbox98fd3a1c6501446aa57a9c8b76e56e15.mailgun.org/messages", - auth=("api", "7535a010b822cd503dc5a11670a64194-f55d7446-76d3865a"), + f"{settings.MAILGUN_API_URL}/{settings.MAILGUN_SENDER_DOMAIN}/messages", + auth=("api", settings.MAILGUN_API_KEY), data={ - "from": "Excited User <mailgun@sandbox98fd3a1c6501446aa57a9c8b76e56e15.mailgun.org>", + "from": f"No reply - Alphabet Learning <noreply@{settings.MAILGUN_SENDER_DOMAIN}>", "to": [ email, ], @@ -112,10 +113,10 @@ def send_mailgun_verification( If you didn't request this, please ignore this email. """ requests.post( - "https://api.mailgun.net/v3/sandbox98fd3a1c6501446aa57a9c8b76e56e15.mailgun.org/messages", - auth=("api", "7535a010b822cd503dc5a11670a64194-f55d7446-76d3865a"), + f"{settings.MAILGUN_API_URL}/{settings.MAILGUN_SENDER_DOMAIN}/messages", + auth=("api", settings.MAILGUN_API_KEY), data={ - "from": "Excited User <mailgun@sandbox98fd3a1c6501446aa57a9c8b76e56e15.mailgun.org>", + "from": f"No reply - Alphabet Learning <noreply@{settings.MAILGUN_SENDER_DOMAIN}>", "to": [ email, ], |