import os
import requests

key = os.environ.get('MAILGUN_KEY')
request_url = 'https://api.eu.mailgun.net/v3/mail.dotty.cloud/messages'

def send(recipient, subject, message, from_address = 'Dotty <noreply@mail.dotty.cloud>'):
  response = requests.post(request_url, auth=('api', key), data={
    'from': from_address,
    'to': recipient,
    'subject': subject,
    'text': message
  })
  response.raise_for_status()
