Created
March 12, 2019 14:55
-
-
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
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 | |
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