Tech Incent
Django

Django Send Email with AWS Simple Email Service(SES)

Do you want to send emails from your Django app? There are many reasons to send emails from your Django app including email confirmation, password reset, notifications, newsletters, promotions, marketing purposes d There are many ways to send emails from the Django app.

In this article, I am going to explain how to send emails via custom Email ([email protected]) with AWS Simple Email Service (SES) SMTP Server. However, you can use any email [email protected], [email protected] which was the active mail address.

AWS SES has a great response to an SMTP server. You can use AWS SES for small or large complex applications and with the best service, it costs cheap. We all know about the AWS services that that is the best

So how much cost of AWS Simple Email Service (SES)

AWS offers free usage with the first 62,000 emails for each month. After free usage, it’s cost $0.10 for 1000 emails. wow, it’s too cheap cost. if you are sending attachments it’s cost $0.12 for each GB of attachments you send. For more information check this aws ses pricing

Setup AWS SES with Django application

Here is two part of the setup…

  1. Setup in AWS Management Console
  2. Setup in Django application

Step #1. First of all let’s setup SES in AWS management console

  1. Login to aws management console or create here aws account
  2. Find simple email service or ses in aws console
    aws ses search
  3. Now you are in the SES service section. New account amazon limit there SES Sending limits with 200 emails for each month. you can increase your sending email limits.
    increae
    Submit a ticket for increase email limit. it will be increased up to 2 days
    increase
  4. Verify Your Domain address, and you will get an email from Amazon Web Services – Email Address Verification Request, in this email you have a verification link.

    click this verification link, it will take you confirmation page of Amazon Web Service.
    verify-d

  5. Create credentials for SES. So we use pure SMPT Credentials for SES
    1. Go to SMPT settings and create credentials
      add-user
    2. Choose a IAM UserName
      add-user-2
    3. Now download credentials file. So CSV File will be downloaded
      add-user-3
    4. Open Download file
      IAM User Name: ses-smtp-your-username Smtp Username: "your username" example: AKIA6IVWV2ZU4OZYIXOC Smtp Password: "your Password" example: BOWvJ+zG+VMBIyDqT8alFmEqKg6uJpPz6PPMKFsxBoWI 
  6. Great our AWS setup is now complete we can go to Django setup

Step #2. setup in Django application

  1. First, add email config into settings.py file EMAIL_USE_TLS = True EMAIL_HOST = 'email-smtp.ap-south-1.amazonaws.com' EMAIL_HOST_USER = 'Smpt Username' EMAIL_HOST_PASSWORD = 'Smpt Password' EMAIL_PORT = 587

    Note: EMAIL_HOST may be different from your case. find from here:
    BOWvJ+zG+VMBIyDqT8alFmEqKg6uJpPz6PPMKFsxBoWI

Now test you setup

from django.core.mail import send_mail
>>> send_mail(
...   "mail subject",
...   "mail message here",
...   "[email protected]",
...   ["[email protected]", "[email protected]"],
...   fail_silently=False,
...   html_message=html__
...)

Response: send_mail return 1 if mail successfully sends other case show errors message because of fail_silently=false.

Note[email protected], [email protected], [email protected] is dummy mail address it’s not work

Related posts

Django abstractuser with example

Sajal Mia

How to deploy django and react in heroku ?

Tech Incent

How to render Django form individual fields manually?

Sajal Mia

How to set up django react together ?

Sajal Mia

Explained Django inline formset factory with example?

Sajal Mia

How to create Django form?

Sajal Mia

8 comments

zortilonrel 01/09/2021 at 9:11 AM

I have read some good stuff here. Definitely price bookmarking for revisiting. I wonder how much attempt you place to make the sort of fantastic informative website.

admin 14/09/2021 at 7:03 PM

thank you

astra theme customization 14/10/2021 at 5:09 AM

I see something genuinely interesting about your site so I saved to favorites.

slot online terbaik resmi 14/10/2021 at 8:40 AM

I believe this internet site has got some real superb information for everyone : D.

zoo animals behind bars 22/10/2021 at 5:01 PM

Pretty section of content. I just stumbled upon your blog and in accession capital to assert that I acquire in fact enjoyed account your blog posts. Anyway I’ll be subscribing to your augment and even I achievement you access consistently quickly.

slide out shelves 07/12/2021 at 12:47 AM

I have been exploring for a bit for any high-quality articles or blog posts on this kind of area . Exploring in Yahoo I at last stumbled upon this web site. Reading this information So i’m happy to convey that I’ve an incredibly good uncanny feeling I discovered exactly what I needed. I most certainly will make sure to do not forget this site and give it a glance on a constant basis.

Fredrick 23/12/2021 at 11:31 AM

Exactly the kind of content that enhances the net. Many thanks!

Cesar 18 23/12/2021 at 9:36 PM

Incredible. You aren’t so good the fact that you’re so good currently. Your help woke me up. Thank you incredibly much.

Comments are closed.