Sending Email : Django Terminal Test.

1 comment

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 with code below:
    #settings for django email( writing for gmail)
    EMAIL_USE_TLS = True
    EMAIL_HOST = ''
    SITE_HOST = ''
    DEFAULT_FROM_EMAIL ='Dotorbit Team '
    EMAIL_PORT = 587
    EMAIL_HOST_PASSWORD = 'your-password'
    #Run interactive mode, 
    python shell
    #Import the EmailMessage module,
    >>>from django.core.mail import EmailMessage
    #Send the email,
    >>>email = EmailMessage('Subject goes here ', ' Body goes here ', to=[''])

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