Recall & Review
beginner
What is Flask-Mail used for in a Flask application?
Flask-Mail is an extension that helps send emails easily from a Flask app by managing email server settings and sending messages.
Click to reveal answer
beginner
Which configuration keys are essential to set up Flask-Mail?
You need to set MAIL_SERVER (email server address), MAIL_PORT (server port), MAIL_USERNAME (your email), MAIL_PASSWORD (your email password), and MAIL_USE_TLS or MAIL_USE_SSL (security).
Click to reveal answer
beginner
How do you initialize Flask-Mail in your Flask app?
First, create a Mail object with your app: <br> <code>from flask_mail import Mail<br>mail = Mail(app)</code> <br> This connects Flask-Mail to your app using the app's config.Click to reveal answer
beginner
What method do you use to send an email with Flask-Mail?
You create a Message object with subject, sender, recipients, and body, then call
mail.send(message) to send it.Click to reveal answer
intermediate
Why is it important to use environment variables for MAIL_USERNAME and MAIL_PASSWORD?
To keep your email credentials safe and not expose them in your code, especially if your code is shared or public.
Click to reveal answer
Which Flask-Mail configuration key sets the email server address?
✗ Incorrect
MAIL_SERVER is the key to specify the email server address.
What does the MAIL_USE_TLS setting do?
✗ Incorrect
MAIL_USE_TLS enables a secure encrypted connection using TLS for sending emails.
How do you send an email after creating a Message object in Flask-Mail?
✗ Incorrect
The Mail object has a send() method to send the Message.
Which of these is NOT a required configuration for Flask-Mail?
✗ Incorrect
MAIL_SUBJECT is not a configuration key; subject is set per email message.
Why should you avoid hardcoding MAIL_PASSWORD in your Flask app?
✗ Incorrect
Hardcoding passwords risks exposing them publicly or in version control.
Explain the steps to set up Flask-Mail in a new Flask project.
Think about what you need to configure, initialize, and how to send emails.
You got /4 concepts.
Describe why using environment variables for email credentials is important in Flask-Mail setup.
Consider what happens if your code is shared or uploaded online.
You got /3 concepts.