summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2006-06-17 13:35:45 +0000
committerweasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede>2006-06-17 13:35:45 +0000
commitaa27c79f6393552f5f90b12356bea5debc3a19b2 (patch)
treeff3e3813aeccbcf4e353124ae791b1a6ece19809
parentaa601f0f720de2fb1b3775029ad672447ab87582 (diff)
Rewrite Delivered-To to X-OLD-Delivered-To to avoid mail-loop warnings,2
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@137 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
-rwxr-xr-xsplit-mailman-mails-and-discard-and-save13
1 files changed, 8 insertions, 5 deletions
diff --git a/split-mailman-mails-and-discard-and-save b/split-mailman-mails-and-discard-and-save
index daa4047..e682f60 100755
--- a/split-mailman-mails-and-discard-and-save
+++ b/split-mailman-mails-and-discard-and-save
@@ -237,11 +237,14 @@ def process_mail(filename)
else
store_in_maildir(MAIL_PROCESSED_FORWARDED, message)
- headers = message.header.to_s
- body = message.body.to_s
- new_headers = headers.gsub(/^Delivered-To:/, 'X-OLD-Delivered-To:')
- new_message = RMail::Parser.read new_headers + "\n" + body
- store_in_maildir(OUTBOX_HUMANS, new_message)
+ # rewrite Delivered-To to X-OLD-Delivered-To to avoid mail loop warnings.
+ m = message.to_s.split(/\n/)
+ new_m = []
+ while m.size > 0 and line = m.shift != ""
+ m << line.gsub(/^Delivered-To:/, 'X-OLD-Delivered-To:')
+ end
+ new_m.concat m
+ store_in_maildir(OUTBOX_HUMANS, m.join("\n"))
end
else
STDERR.puts "Unknown action #{ACTION}!"