Sending Email : Django Terminal Test.

on July 31, 2013

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 = 'dotorbit.dev@gmail.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=['reciever@email.com'])
    >>>email.send()
    >>>1

This will return 1, means everything is working fine. form and view, I'll write in next post.

1 comments:

David Jackson said...

Hello this is nice blog thank you for sharing this blog there are more content about test only glendora I appreciate good job thank you
test only glendora

Post a Comment