Build email sending function in Django application

It has been a long time since Django changed the wind. Today I will work with you to build the Email sending function in Django application. Let's start now. Let's go

Install the project

First we need to create a django project, and you can do that by opening the terminal and typing the following command:

Now we move into the project folder we just created

Create a new app

Next we create a new app with the following command:

With the above command we have created 1 send_email directory in the project directory

Edit the project settings

In this step, please open the settings.py file , then you set this information for your desired configuration

In the INSTALLED_APPS block you need to add the following line to use the app send_email :

After adding, this block has the following content:

Next you set the static file path for the application

Create urls

Editing the url in the plc_email directory is like this:

Then you create more files urls.py in the send_email directory with the file content:

Add Views

Go to file views.py in send_email folder and edit to:

Solve problems in Scalable Social Network - Register now!
Solve problems in Scalable Social Network – Register now!

Add templates

Now we create the templates folder in the send_email folder . Then create 2 index.html and success.html files in the newly created templates directory . Content of index.html file :

Content file success.html :

Let's try it!

Let's try it now

So we've built the email sending function in the Django application. See you again on the blog post.

Happy coding!

ITZone via Viblo

Share the news now