Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mail-prepender.sh support Return-Path in the first line #7

Merged
merged 2 commits into from
Jan 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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