Last active
January 16, 2026 15:59
-
-
Save ranvel/1d040ba7b7365cb6f420698c2a4376c1 to your computer and use it in GitHub Desktop.
Open mailto: links in Fastmail Safari Single-Site webapp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/zsh | |
| FASTMAIL_BASE="https://app.fastmail.com/mail/inbox/compose" | |
| # 1. In safari, go to "https://app.fastmail.com" | |
| # 2. Save this as "FastMail.app" in ~/Applications | |
| # 3. Get python3 and make sure it is in path as "python3" (just try to run `python3` in a brand new terminal session | |
| # encode URLs using python3 | |
| urlencode() { | |
| python3 - "$1" <<'EOF' | |
| import sys, urllib.parse | |
| print(urllib.parse.quote(sys.argv[1])) | |
| EOF | |
| } | |
| for url in "$@"; do | |
| if [[ "$url" == mailto:* ]]; then | |
| # Strip off the mailto: scheme | |
| rest=${url#mailto:} | |
| # Everything before the first ? is the address part | |
| addr=${rest%%\?*} | |
| if [[ -n "$addr" ]]; then | |
| encoded_to=$(urlencode "$addr") | |
| open -a ~/Applications/Fastmail.app "${FASTMAIL_BASE}?to=${encoded_to}" | |
| fi | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment