Final README.md (with Gemfile & Bundler Instructions)
gmail_sms_notifier
A lightweight Ruby tool that monitors your Gmail account and sends an SMS via OpenPhone when new unread emails arrive from specific sender domains (e.g., state.gov, ssa.gov). Ideal for time-critical alerts that should reach your phone — and your wrist via Apple Watch — without unnecessary noise.
Features
Connects to Gmail using a Google Workspace service account
Filters by sender domains (e.g., state.gov, ssa.gov)
Sends SMS alerts using the OpenPhone API
Designed for crontab use — runs silently in the background
Marks processed messages as read to avoid duplicate alerts
Reads config from a YAML file (.config.yml)
Requirements
Ruby 3.x
Bundler
OpenPhone API access
Gmail API enabled in Google Cloud
A Google Workspace service account with domain-wide delegation
Installation
Clone this repo (or place it in /opt/gmail_sms_notifier)
Install dependencies using Bundler:
cd /opt/gmail_sms_notifier
bundle install
This requires a Gemfile in the same directory (included below).
I have been using FairEmail for a couple of years. Email goes to my desk, and to my Android phone using IMAP and 'leave messages on server'. Less than 10 dollars for the pro version. Most importantly, no advertising or data capture.
Thanks for sharing your experience with FairEmail. It's a solid choice for many users, especially with its privacy-focused features and IMAP support.
However, I have plenty of email clients already. The key difference here is that gmail_sms_notifier isn't about email app notifications—it's about sending actual SMS messages via the OpenPhone API when only critical email arrive. This ensures immediate alerts that reach my phone and wrist, even when I'm away from my devices.
Passport Tracking: SMS Notification from state.gov
I get SMS alerts if a critical email arrives (like from the US government about my passport) — skipping spam filters and convoluted mail rules.
All of this runs through the OpenPhone API. I hardly use email, and definitely not IMAP — that’s rusted-out tech from 20+ years ago, not something I’d touch in 2025.
I also built a custom app that logs all incoming SMS alerts into a MySQL DB via webhook. A Rails frontend with DataTables lets me sort, search, and filter when needed.
Hope that clears it up. I avoid email for critical alerts unless absolutely forced — and even then, I immediately forward high-priority messages to my phone via SMS. IMAP has been out of my stack for decades.
The only reason I wrote this code is because the US government still sends critical notices via (antique) email — and since I rarely check email, this ensures I get an immediate SMS alert if something important like “your passport has arrived at the embassy” hits my inbox.
I just used a basic webhook and a bash script to catch the incoming POST and parse the JSON with jq. It then sends an email using mailx with the SMS content.
In my post, I discussing a webhook into gmail which sends an SMS notification.
Maybe it is a language thing, but the post above by @Sikuoshi seems to discuss something quite different and unrelated to coverting gmail messages to SMS messages received as a notice on a mobile phone.