This Python script simulates an email management application using an Email class and several functions to interact with a list of emails (inbox). The application allows users to mark emails as read, list unread emails, and quit the application.
- Email Class
- Inbox Initialization
- Populate Inbox Function
- List Emails Function
- Read Email Function
- Menu Functionality
- Usage
- Author
The Email class is initialized with three attributes: email_address, subject_line, and email_content. It also includes a mark_as_read method to update the has_been_read attribute.
An empty list inbox is initialized to store Email objects.
The populate_inbox()
function creates and adds three sample Email objects to the inbox list upon initialization.
The list_emails()
function iterates through the inbox list and prints the subject lines of all emails along with their index.
The read_email(i)
function retrieves and marks a specific email from the inbox as read, displaying its content if it hasn't been read already.
The main loop (while True
) displays a menu with options:
- Option 1: Read an email by listing emails and marking selected ones as read.
- Option 2: View unread emails by listing emails that haven't been marked as read.
- Option 3: Quit the application.
Run the script to start the email management application. Follow the prompts to read emails, view unread emails, or quit the application.