Lab: Automating Email
Objective
-
Generate sample files (PDF, image, chart).
-
Configure Gmail for sending emails with App Passwords.
-
Run the provided Python script to send:
-
Weekly Sales Report with attachments
-
Product Catalog with inline image
-
Personalized updates to multiple contacts
-
Step 1: Generate Required Files
1. Weekly Report (PDF)
Create dummy pdf file
2. Chart Image
chart.png
3. Product Image
(product.jpg)
Use Paint to create the above two files
Step 2: Folder Structure
Your Folder structure should reflect this

Lab 9 folder structure
Step 3: Configure Gmail
- Go to your Google Account: https://myaccount.google.com/security
-
Enable 2-Step Verification in Google Account.
- Go to your Google Account: https://myaccount.google.com/apppasswords
-
Generate an App Password for “Mail → Other (Python Script)”.
-
Use that password in your script when prompted.
Step 5: Run the Email Script
Now run your main script:
You should see outputs like:
At the end of this lab, students will have:
-
Created PDF, chart, and image files.
-
Sent emails with attachments and inline images.
-
Sent personalized emails to multiple contacts.
