Skip to content

Commit 913a400

Browse files
author
Victor Bouvier-Deleau
committed
Change pseudorandom string generation
Use LC_ALL instead of LC_CTYPE to fix an issue with tr not recognizing some characters outputed by /dev/urandom Use [:alnum:] instead of '0-9' to get all alphanumeric characters Increase string size from 24 to 32
1 parent c2b028e commit 913a400

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

format_email.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
# Usage: format_email "Subject" "address@example.com" /path/to/body.html [/path/to/attachment.ext] | sendmail -i -t
1010
format_email () {
11-
email_boundary=$(LC_CTYPE=C tr -dc '0-9' < /dev/urandom | head -c 24)
11+
email_boundary=$(LC_ALL=C tr -dc '[:alnum:]' < /dev/urandom | head -c 32)
1212

1313
echo "MIME-Version: 1.0"
1414
echo "Subject: ${1}"

0 commit comments

Comments
 (0)