diff options
-rwxr-xr-x | bin/email | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -4,7 +4,7 @@ set -eu usage() { cat <<-'EOF' Usage: - email [-s SUBJECT] [-f FROM] ADDRESS... < BODY + email [-s SUBJECT] [-f FROM] [ADDRESS...] < BODY email -h EOF } @@ -17,7 +17,7 @@ help() { -f FROM the addr to send from (default: "eu@euandre.org") -h, --help show this message - ADDRESS the email addresses to send the email to + ADDRESS the email addresses to send the email to (default: "eu@euandre.org") BODY the text to be sent as the body @@ -29,6 +29,11 @@ help() { Send 10 numbers to mail@example.com: $ seq 10 | email -s number mail@email.com + + + Send a UUID using all defaults: + + $ uuid | email EOF } @@ -70,17 +75,15 @@ while getopts 'f:s:h' flag; do done shift $((OPTIND - 1)) -ADDRESS="${1:-}" +ADDRESS="$(printf '%s\n' "$@" | tr '\n' ',' | sed 's|,|, |g;s|, $||')" -eval "$(assert-arg -- "${SUBJECT:-}" '-s SUBJECT')" -eval "$(assert-arg -- "$ADDRESS" 'ADDRESS')" { cat <<-EOF Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: $FROM - To: $ADDRESS + To: ${ADDRESS:-eu@euandre.org} Subject: $(printf '%s' "$SUBJECT" | tr -d '\n') EOF |