0
0
Flaskframework~10 mins

Why email matters in web apps in Flask - Test Your Understanding

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

Complete the code to import the Flask mail extension.

Flask
from flask_mail import [1]
Drag options to blanks, or click blank then click option'
ASendMail
BMail
CMessage
DEmail
Attempts:
3 left
💡 Hint
Common Mistakes
Using Email or Message instead of Mail
Forgetting to import Flask-Mail
2fill in blank
medium

Complete the code to configure the mail server in Flask app.

Flask
app.config['MAIL_SERVER'] = '[1]'
Drag options to blanks, or click blank then click option'
Asmtp.gmail.com
Blocalhost
Cmail.example.com
Dsmtp.mailtrap.io
Attempts:
3 left
💡 Hint
Common Mistakes
Using localhost instead of real SMTP server
Using incorrect SMTP server address
3fill in blank
hard

Fix the error in creating the email message object.

Flask
msg = Message(subject='Hello', sender='[1]', recipients=['user@example.com'])
Drag options to blanks, or click blank then click option'
Aadmin@example.com
Bexample.com
Cnoreply@example.com
Duser@example.com
Attempts:
3 left
💡 Hint
Common Mistakes
Using recipient email as sender
Using domain only without @ sign
4fill in blank
hard

Fill both blanks to send an email with Flask-Mail.

Flask
mail = [1](app)
mail.[2](msg)
Drag options to blanks, or click blank then click option'
AMail
Bsend
Csend_message
DMessage
Attempts:
3 left
💡 Hint
Common Mistakes
Using Message instead of Mail for mail object
Using send_message which is not a Flask-Mail method
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension filtering emails with 'gmail.com'.

Flask
filtered_emails = {email: [1] for email in emails if [2] in email and email.endswith('[3]')}
Drag options to blanks, or click blank then click option'
Alen(email)
B'@'
Cgmail.com
Demail.count('@')
Attempts:
3 left
💡 Hint
Common Mistakes
Using email.count('@') instead of '@' in email
Using wrong domain in endswith