Send email from Gmail Id in Django using HTML Template
- Python 3.8
- Pip
- Git
- Clone the project using the command "git clone https://github.com/sukanya-pai/Django-Email-Sender.git"
- In PipFile, the dependencies are mentioned. It is recommended to run the app inside a virtual environment to avoid conflict of existing dependencies.
- Run the command "pip install pipenv"
- Run "pipenv shell". Creates virtual env
- Run "pipenv install". Installs dependencies from the PipFile and creates PipFile.lock
- Run "python manage.py runserver" to start the server
- Make changes in the views.py file of the "email_sender_app" directory inside the send_mail() method to add your mail address and the recipients mail address accordingly.
- Make changes in the settings.py of the "email_project" directory file with your gmail id and your app password.
- Since this is a demo project, the password is written directly in settings.py. For security reasons of your account, it is recommended you store the password in key vault or encrypt it and then host the application or push your changes to GitHub.
- Read change log to see what has changed.
- Go to https://myaccount.google.com/security
- Scroll till you find "Signing in to Google"
- Only if you follow the above steps, then you can send mail from your Gmail account using your django code.