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
                    
Madra David
Madra David
1 minute read
TFT

Share this article

Next Post

Securing your django application with letsencrypt and django-sslify

Previous Post

Adding SMS messaging to your Django application with Twilio

I send out tips on how to improve your website's performance

Find new customers and prospects in less than 30 seconds.
Build outbound email prospecting lists in seconds.

I send out tips on how to improve your website's performance

user-image

Published mars 23 2016

by Madra David