Sending Email Via Django

In your settings.py, set following configuration,

EMAIL_HOST = 'smtp.gmail.com'

EMAIL_HOST_USER = '[email protected]'

EMAIL_HOST_PASSWORD = 'mypassword'

EMAIL_PORT = 587

EMAIL_USE_TLS = True

Now, go to python shell and,

from django.core.mail import send_mail

Now call below function,

send_mail('Subject of email',
          'Here is the message.',
          '[email protected]',  
          ['[email protected]'],
          fail_silently=False,
         )

Thats all, an email with subject "Subject of email" and body "Here is the message" has been sent to your "[email protected]" email.

results matching ""

    No results matching ""