Django

Django Email

Email backend, send_mail, EmailMessage, HTML emails, attachments, async email, Celery integration

18 perguntas de entrevista·
Mid-Level
1

Which Django setting configures the email sending backend?

Resposta

The EMAIL_BACKEND setting configures the email sending backend in Django. By default, it uses smtp.EmailBackend which sends emails via SMTP. In development, it's common to use console.EmailBackend to display emails in the console or filebased.EmailBackend to save them to files.

2

Which Django function allows sending a simple email with a subject, message, and recipient list?

Resposta

The send_mail function from django.core.mail is the simplest method to send an email in Django. It takes as required parameters the subject, message, sender, and recipient list. It returns the number of successfully sent emails (0 or 1).

3

Which email backend to use in development to display emails in the console instead of sending them?

Resposta

The django.core.mail.backends.console.EmailBackend backend displays emails in standard output (console) instead of actually sending them. This is ideal for development as it allows checking email content without SMTP configuration and without risking sending test emails to real recipients.

4

Which Django class to use for creating an email with more control than send_mail, including adding custom headers?

5

How to send an HTML email with a text fallback version in Django?

+15 perguntas de entrevista

Domine Django para sua proxima entrevista

Acesse todas as perguntas, flashcards, testes tecnicos, exercicios de code review e simuladores de entrevista.

Comece gratis