A MagicMirror² module that scans your IMAP email accounts for shipping and delivery notifications and displays package tracking status on your mirror.
Unlike other package tracking modules, MMM-Packages works by reading the shipping notification emails you already receive from carriers like Amazon, UPS, FedEx, and USPS. No API keys or tracking number entry required -- just point it at your email accounts and it finds your packages automatically.
- Scans multiple IMAP email accounts for shipping notifications
- Detects packages from Amazon, UPS, FedEx, and USPS
- Shows delivery status: Shipped, Out for Delivery, or Delivered
- Extracts item names from email subjects when available
- Cycles between carrier/status and item name display
- Uses
BODY.PEEK[]to fetch emails without marking them as read - Deduplicates packages across multiple notification emails
- Fully configurable through MagicMirror's
config.js
- Navigate to your MagicMirror modules directory:
cd ~/MagicMirror/modules- Clone this repository:
git clone https://github.com/MatthewNewsum/MMM-Packages.git- Install the Python dependency:
pip3 install python-dotenvNote: The module requires Python 3 with the imaplib, email, json, re, and datetime standard library modules (all included with Python).
Add the following to the modules array in your MagicMirror config/config.js file:
{
module: "MMM-Packages",
position: "bottom_left",
config: {
accounts: [
{
server: "imap.gmail.com",
username: "[email protected]",
password: "your-app-password",
},
{
server: "imap.mail.yahoo.com",
username: "[email protected]",
password: "your-app-password",
},
],
updateInterval: 5 * 60 * 1000,
cycleInterval: 4000,
lookbackDays: 1,
maxPackages: 5,
}
},For Gmail accounts, you must use an App Password rather than your regular password:
- Enable 2-Step Verification on your Google account.
- Go to App Passwords.
- Generate a new app password for "Mail".
- Use that generated password in the config above.
For Yahoo accounts, generate an app password at Yahoo Account Security.
| Option | Description | Default |
|---|---|---|
accounts |
Array of IMAP account objects (see above) | [] |
updateInterval |
How often to check email for updates (milliseconds) | 300000 (5 min) |
cycleInterval |
How often to cycle between status and item name (ms) | 4000 (4 sec) |
lookbackDays |
How many days back to search for shipping emails | 1 |
maxPackages |
Maximum number of packages to display | 5 |
Each account object in the accounts array requires:
| Field | Description | Example |
|---|---|---|
server |
IMAP server hostname | "imap.gmail.com" |
username |
Email address / login | "[email protected]" |
password |
Password or app-specific password | "abcd efgh ijkl mnop" |
- On startup and at each
updateInterval, the node helper writes your account configuration to a temporary JSON file and invokes the Python script. - The Python script connects to each configured IMAP account over SSL and searches the inbox for emails received within the
lookbackDayswindow. - It checks each email's sender address against a list of known carrier addresses (Amazon, UPS, FedEx, USPS).
- For matching emails, it determines the package status by scanning the subject and body for keywords like "has shipped", "out for delivery", or "delivered".
- When possible, it extracts the item name from the email subject (e.g., quoted product names in Amazon confirmation emails).
- Packages are deduplicated by carrier and item name, with status upgrades applied (e.g., if a "shipped" and "out for delivery" email exist for the same package, the more recent status wins).
- Results are written to a JSON file that the node helper reads and sends to the front-end module for display.
- The front-end cycles between showing carrier/status and item name for packages that have an identified item.
Emails are fetched using BODY.PEEK[] which does not mark messages as read, so your inbox is unaffected.
- Amazon -- auto-confirm, shipment-tracking, ship-confirm, delivery-tracking, order-update
- UPS -- tracking, pkginfo, noreply
- FedEx -- fedex, trk, noreply
- USPS -- usps, auto-reply, noreply
MIT License. See LICENSE for details.
