Skip to content

Instantly share code, notes, and snippets.

@matt17r
Created November 18, 2021 18:00
Show Gist options
  • Save matt17r/7b897d3592a4dab188859aaef1f345f8 to your computer and use it in GitHub Desktop.
Save matt17r/7b897d3592a4dab188859aaef1f345f8 to your computer and use it in GitHub Desktop.
Helper script for [Bumpr](getbumpr.com) to send emails via Gmail
#!/bin/sh
# URL encode mailto link using Perl
url="$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$2")"
# Then send email via one of the following Gmail accounts
# 1) Default (first logged in) Gmail/Workspace account
open -u "https://mail.google.com/mail/?extsrc=mailto&url=${url}"
# 2) Specific domain (first logged in user from that domain - falls back to (1) Default if not logged in to domain)
# open -u "http://mail.google.com/a/example.com/mail/?extsrc=mailto&url=${url}"
# 3) Specific email address (falls back to (1) Default if not logged in to this account)
# open -u "http://mail.google.com/mail/u/someone@example.org/?extsrc=mailto&url=${url}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment