Sending email from your Django application with Mailgun
Step 1
pip install django-mailgun
Step 2
EMAIL_BACKEND = 'django_mailgun.MailgunBackend'
MAILGUN_ACCESS_KEY = 'ACCESS-KEY'
MAILGUN_SERVER_NAME = 'SERVER-NAME'
Step 3
from django.core.mail import EmailMultiAlternatives
def awesome_view():
'''send email via mailgun'''
subject = "Hello, its me"
text_content = "I was wondering if after all these years"
sender = "alone@fromtheotherside.com"
receipient = "movedon@fromtheotherside.com"
msg = EmailMultiAlternatives(subject, text_content, sender, [receipient])
respone = msg.send()
# do something with response