Skip to content

Instantly share code, notes, and snippets.

@jlamoree
Created March 12, 2019 14:55
Show Gist options
  • Save jlamoree/1320633f44e12e1caa3424f00ece421b to your computer and use it in GitHub Desktop.
Save jlamoree/1320633f44e12e1caa3424f00ece421b to your computer and use it in GitHub Desktop.
Extract the message body (in HTML) from an Adobe ColdFusion saved mail file
#!/bin/bash
cfmailfile=${1:-_}
script_name="$( basename "${BASH_SOURCE[0]}" )"
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
usage() {
echo "Usage: $script_name cfmailfile"
exit 1
}
error() {
echo "Error: $1"
exit 1
}
if [ "$cfmailfile" == "_" ]; then
usage
fi
if [ ! -r "$cfmailfile" ]; then
error "File name found: $cfmailfile"
fi
# The Adobe ColdFusion mail storage format prefixes lines with 'body: '
# We'll preserve lines that are just whitespace in case the author thought it was important
grep -E '^body: ' "$cfmailfile" | sed -e 's/^body: //'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment