0
0
Apache Airflowdevops~10 mins

EmailOperator for notifications in Apache Airflow - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the EmailOperator from Airflow.

Apache Airflow
from airflow.providers.smtp.operators.email import [1]
Drag options to blanks, or click blank then click option'
AEmailOperatorTask
BEmailOperator
CEmailNotify
DEmailTask
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect class names like EmailNotify or EmailTask.
Forgetting to import from airflow.providers.smtp.operators.email.
2fill in blank
medium

Complete the code to create an EmailOperator task named 'send_email'.

Apache Airflow
send_email = EmailOperator(task_id='send_email', to='user@example.com', subject='Test', [1]='This is a test email', dag=dag)
Drag options to blanks, or click blank then click option'
Abody
Bemail_body
Chtml_content
Dcontent
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'html_content' or 'content' instead of 'body'.
Misspelling the parameter name.
3fill in blank
hard

Fix the error in the EmailOperator initialization by completing the missing parameter for the sender email.

Apache Airflow
send_email = EmailOperator(task_id='send_email', to='user@example.com', subject='Test', body='Hello', [1]='noreply@example.com', dag=dag)
Drag options to blanks, or click blank then click option'
Aemail_from
Bsender
Cfrom
Dfrom_email
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'from' which is a reserved keyword in Python.
Using 'sender' or 'email_from' which are incorrect parameter names.
4fill in blank
hard

Fill both blanks to create an EmailOperator that sends to multiple recipients and includes a CC address.

Apache Airflow
send_email = EmailOperator(task_id='send_email', to=[1], cc=[2], subject='Hello', body='Hi there', from_email='noreply@example.com', dag=dag)
Drag options to blanks, or click blank then click option'
A['user1@example.com', 'user2@example.com']
B'user1@example.com'
C'cc@example.com'
D['cc@example.com']
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string instead of a list for multiple recipients.
Using a string for cc when a list is expected.
5fill in blank
hard

Fill all three blanks to create an EmailOperator with attachments, a custom mime subtype, and a reply-to address.

Apache Airflow
send_email = EmailOperator(task_id='send_email', to='user@example.com', subject='Report', body='See attached', files=[1], mime_subtype=[2], reply_to=[3], from_email='noreply@example.com', dag=dag)
Drag options to blanks, or click blank then click option'
A['/path/to/report.pdf']
B'mixed'
C'reply@example.com'
D'alternative'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing files as a string instead of a list.
Using wrong mime subtype like 'alternative' when attachments exist.
Omitting the reply_to parameter or using wrong format.