While I was making contact-us form in PHP for my client then I thought about to do same in Djago-Python. Target was to get the form input and email it. Here I'm going to test only the DjangoEmail module using shell.
Edit settings.py with code below:
#settings for django email( writing for gmail) EMAIL_USE_TLS = True EMAIL_HOST = 'smtp.gmail.com' SITE_HOST = '127.0.0.1:8000' DEFAULT_FROM_EMAIL ='Dotorbit Team
' EMAIL_PORT = 587 EMAIL_HOST_USER = 'email@example.com' EMAIL_HOST_PASSWORD = 'your-password'
#Run interactive mode, python manage.py shell #Import the EmailMessage module, >>>from django.core.mail import EmailMessage #Send the email, >>>email = EmailMessage('Subject goes here ', ' Body goes here ', to=['firstname.lastname@example.org']) >>>email.send() >>>1
This will return 1, means everything is working fine. form and view, I'll write in next post.