Please, use django api to send an email. https://docs.djangoproject.com/en/dev/topics/email/