NIH | National Cancer Institute | NCI Wiki  

The CodaLab website requires the ability to send emails when a user forgets his or her password and requests a password reset.

We use the "SendGrid add-on to Windows Azure" to send emails via SMTP.

The SendGrid developer documentation explains how to integrate the email service in Django. In addition, the Django project provides comprehensive documentation: Additional notes are collected below.


The key settings that affect how emailing works follow.

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST_USER = '<insert username>'
EMAIL_HOST_PASSWORD = '<insert password>'

The Site configuration also plays a role because it defines the domain name associated with the website. The site domain name and a human-readable name of the website are defined in the settings by:


The script inserts these names in the database. Recall that is located in codalab/scripts and is used to insert constants into the database. To illustrate how the site info is used, consider the email sent to a user resetting his or her password:

Subject: [CodaLab] Password Reset Email
Date: Thu, 03 Oct 2013 22:42:55 -0000

You're receiving this email because you or someone else has requested a password 
for your user account at It can be safely ignored if you did not request 
a password reset. Click the link below to reset your password.

In case you forgot, your username is someuser.

Thanks for using our site!

The subject field of the email uses the verbose name of the site, while the body of the email includes several references to, which is given by the site's domain name.

Testing Without Sending E-mails

As noted in the Django documentation, one can avoid sending emails during development but still see them in the console by setting:

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

This is the default configuration for the base Dev configuration.

  • No labels