Say goodbye to generic gray initials. Automatically fetch sender avatars and company logos for Apple Mail.
MailAvatarSync is a native AppleScript rule for the macOS Mail app. It analyzes incoming emails, finds the sender's photo or company logo online, and automatically updates your Contacts app.
✨ Killer Feature: It intelligently detects automated emails from services (banks, newsletters, SaaS) and creates a Business Contact with the company logo and the "Company" flag checked.
❌ Default Mail.app
✅ With MailAvatarSync
- 🔍 Smart Fetching: Scours Gravatar, Clearbit, and FaviconKit to find the best image.
- 🏢 Business Mode: Automatically creates a new "Company" contact if an organization emails you (e.g., GitHub, Slack, Your Bank) but isn't in your address book.
- 🔒 Privacy Focused: Runs locally on your Mac. No third-party apps required.
- 🎨 Auto-Normalization: Converts various image formats (WebP, ICO) into Contacts-friendly PNGs automatically.
- 🛡 Safe: Never overwrites existing contact photos.
Download the MailAvatarSync file from this repository.
Open Finder, press Cmd + Shift + G, and paste this path:
~/Library/Application Scripts/com.apple.mailMove the downloaded script into this folder.
- Open Mail app → Settings → Rules.
- Click Add Rule.
- Set the condition:
[Every Message](or filter by specific accounts). - Set the action:
[Run AppleScript]and selectMailAvatarSyncfrom the dropdown list. - Click OK.
- OS: macOS Ventura, Sonoma, Sequoia (Tested).
- Permissions: Upon the first run, macOS will ask for permission to access "Contacts". Click Allow.
⚠️ Troubleshooting: If the script doesn't work, check:System Settings→Privacy & Security→Automation→ Ensure Mail has access to Contacts.
The script is written in pure AppleScript and uses standard macOS tools:
- Extracts the sender's email and name.
- Generates an MD5 hash to check Gravatar.
- Parses the email domain to fetch logos via Clearbit/FaviconKit APIs.
- Uses
curlto download andsipsto resize/convert images to PNG. - Updates the local Address Book via the Contacts API.
Feel free to submit Pull Requests if you know of better avatar sources or want to improve the logic!
License: MIT