Send emails from the terminal using pop

Send emails from the terminal using pop

posted 1 min read

Multi-Account Email Sender (pop wrapper)

This script wraps Charm's pop to send emails from multiple accounts directly from your terminal without config edits. Select your email, then use pop's interactive UI or CLI flags.

Features

  • Switch between multiple SMTP accounts via gum (or fallback menu)
  • Secure secrets from ~/.zsh_secrets
  • Exports POP_SMTP_USERNAME, POP_SMTP_PASSWORD, POP_FROM automatically
  • Passes all pop args through
  • Shellcheck clean, bash-compatible

Environment Variables

In ~/.zshrc (non-sensitive):

export POP_SMTP_HOST="smtp.gmail.com" # or smtp.outlook.com, etc.
export POP_SMTP_PORT=587

In ~/.zsh_secrets (chmod 600, gitignore!):

export POP_SMTP_USERNAME1="*Emails are not allowed*"
export POP_SMTP_PASSWORD1="abcd efgh ijkl mnop" # Gmail/Outlook APP PASSWORD
export POP_SMTP_USERNAME2="*Emails are not allowed*"
export POP_SMTP_PASSWORD2="ijkl mnop qrst uvwx" # APP PASSWORD (16 chars, no spaces)

⚠️ POP_SMTP_PASSWORDs are app-specific passwords (not your regular login)—generate from Gmail/Outlook 2FA security settings.

Dependencies

  • pop (Charm)
  • gum (optional, menu fallback built-in)

Usage

chmod +x ~/.local/bin/send_email
send_email # Interactive pop
send_email --to *Emails are not allowed* --subject "Hi" --body "Test"

Here is the link to the gist https://gist.github.com/Vaishnav-Sabari-Girish/51cbfc493fee25c209c39f0e74a17103

Save your dotfiles workflow!

1 Comment

1 vote
1

More Posts

Advent of Code Interactive

Vaishnav-sabari-girish - Dec 1

Note Taking app script

Vaishnav-sabari-girish - Dec 8

Auto-generate Commit Messages with LLMs in Your Terminal

Hank Chiu - Jul 10

How I Automated Git Commands Using Batch Scripting

Ifeanyi - Apr 9

A Shell script that sends a file using magic-wormhole cli

Vaishnav-sabari-girish - Sep 30
chevron_left