Skip to content

Instantly share code, notes, and snippets.

@StevenMaude
Last active May 19, 2026 23:25
Show Gist options
  • Select an option

  • Save StevenMaude/914e9187c09027866fe88958798acb7e to your computer and use it in GitHub Desktop.

Select an option

Save StevenMaude/914e9187c09027866fe88958798acb7e to your computer and use it in GitHub Desktop.
DEPRECATED: see https://github.com/StevenMaude/go-mailin8 — Retrieve most recent email from a mailinator.com temporary email box using curl and jq at the command line; useful if you just want some account activation link, but too lazy to visit the site directly. (It's actually mailinfewerthan8usefullines, rather than mailin8usefullines, but, hey…
#!/bin/bash -e
# mailin8.sh: Collect From, Subject, Body from most recent mail
# in a mailinator.com account.
# Usage: mailin8.sh <local_mailbox_name>
# <local_mailbox_name> is the bit before @mailinator.com
# Create temporary file for cookiejar
TEMP=$(mktemp)
trap 'rm $TEMP' EXIT
INBOX=$1
MAIL_ID=$(curl -s "https://www.mailinator.com/api/webinbox2?x=0&public_to=$INBOX" | jq --raw-output '(.public_msgs | .[length-1]).id')
# The first request below doesn't give us anything useful, but the second
# request fails if we don't save the cookie from here first.
curl -s -c "$TEMP" "https://www.mailinator.com/inbox2.jsp?public_to=$INBOX" > /dev/null
curl -s -b "$TEMP" "https://www.mailinator.com/fetchmail?msgid=$MAIL_ID&zone=public" | jq --raw-output '.data.headers.from, .data.headers.subject, .data.parts[0].body'

Comments are disabled for this gist.