While I was learning how to use django-registration application, I need to know that how to send an email for the user to activate the registration.
During this post I want to show how to test it using shell,
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'youremail@gmail.com'
EMAIL_HOST_PASSWORD = 'your password'
EMAIL_PORT = 587
3. Run interactive mode, python manage.py shell
4. Import the EmailMessage module,
from django.core.mail import EmailMessage
5. Send the email,
email = EmailMessage ('Subject', 'Body', to=['receiver email id'])
email.send()
During this post I want to show how to test it using shell,
- Create a project, django-admin.py startproject pjtname
- Edit settings.py with code below:
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'youremail@gmail.com'
EMAIL_HOST_PASSWORD = 'your password'
EMAIL_PORT = 587
3. Run interactive mode, python manage.py shell
4. Import the EmailMessage module,
from django.core.mail import EmailMessage
5. Send the email,
email = EmailMessage ('Subject', 'Body', to=['receiver email id'])
email.send()
No comments:
Post a Comment