[Answer]-Django website with email support

1👍

Email is a separate service to the website. The email functionality built into Django is only for sending emails, not receiving them.

Since you’re hosting with Webfaction, I would start off with their email docs. They contain instructions how to set up a mailbox on Webfaction, and how to configure your email client to use it.

0👍

You can add this simple Gmail plugin to your settings.py file for email testing. All of your emails must be with gmail. Here is the code:

# EMAIL Settings
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'your_email@gmail.com'
EMAIL_HOST_PASSWORD = 'your_gmail_password'
EMAIL_PORT = 587

You can test the above code snippet in your python shell with:

import django
from django.core.mail import send_mail

send_mail('Subject here', 'Here is the message.', 'gmail_address_to_send_from@gmail.com',
    ['gmail_address_to_send_to@gmail.com'], fail_silently=False)

If you want to have your email use the domain name of your site for the site your building then you need to sign up for email hosting with your web host, or any other email hosting service and configure it to your webserver using the MX Record settings accordingly with your web host.

Leave a comment