Skip to content

Commit

Permalink
Merge pull request #7 from oh2fih/fix-return-path
Browse files Browse the repository at this point in the history
mail-prepender.sh support Return-Path in the first line
  • Loading branch information
oh2fih authored Jan 1, 2024
2 parents 63d7021 + 55a611a commit 6974060
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions bin/mail-prepender.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,24 @@ while getopts ":x:X:" opts; do
esac
done

# A possible Mbox format's From line MUST come before any added headers
# A possible Mbox format's From line MUST come before any added headers &
# Return-Path header conventionally (spamassassin) comes before other headers
read -r line
if [[ "$line" =~ ^From\ .* ]]; then
if [[ "$line" =~ ^(From|Return-Path:)\ .* ]]; then
echo "$line"
firstLine=""
if [[ "$line" =~ ^From\ .* ]]; then
read -r line
if [[ "$line" =~ ^Return-Path:\ .* ]]; then
echo "$line"
secondLine=""
else
secondLine="$line"
fi
fi
else
firstLine="$line"
fi

# Return-Path header conventionally (spamassassin) comes before other headers
read -r line
if [[ "$line" =~ ^Return-Path:\ .* ]]; then
echo "$line"
secondLine=""
else
read -r line
secondLine="$line"
fi

Expand Down

0 comments on commit 6974060

Please sign in to comment.