Django SMTP Protocol with Gmail
This is the free service from gmail to send and receive emails.
What we need for this things done,
- Python/pip install in PC.
- A gmail address for sending email.
Configure the gmail,
- Go to the link using this gmail, [myaccount.google.com/lesssecureapps]
- Turn this on.
- I don't recommend that to turn this on in your personal Gmail, instead create a new gmail account for the project.
Run code in virtual environment
- Clone the project and open the folder in terminal and run -- [pip install pipenv]
- Then active the environment -- [pipenv shell]
- Install all the requirements -- [pipenv install -r requirements.txt]
- Run the project -- [python manage.py runserver]
Configure the settings.py file,
- Go to, the_project/settings.py
- Remove the comment from line 25 according to its upper instruction.
- Enter your email address and password in line 134, 135 according to the instructions. [This email will be use for sending emails]
Configure views.py file,
- Go to, the_app/views.py file,
- Remove the [email protected] [line: 21] and Enter your gmail that you want to receive email.
- You can use multiple email there.
Enjoy!