def hello(request):
subject = u'Получите и распешитесь'
message = u'Спасибо'
from_email = settings.EMAIL_HOST_USER
to_list = ['mail@yandex.ru']
send_mail(subject, message, from_email, to_list, fail_silently=False)
return HttpResponse("hello")
В setting.py:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' #отправляет письма в консоль
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'mail@gmail.com'
EMAIL_HOST_PASSWORD = 'pass'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'mail@gmail.com'
Смотри доки.