Last active
August 13, 2024 22:38
-
-
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…
This file contains 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/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' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Mailinator doesn't work like this anymore, but updated the Go code to work with another service, see the repo linked above.