diff options
author | Peter Palfrader <peter@palfrader.org> | 2007-02-19 11:48:11 +0000 |
---|---|---|
committer | weasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede> | 2007-02-19 11:48:11 +0000 |
commit | 0d22774a9ed34bb92a84ef091a8db9c7703edfc7 (patch) | |
tree | 55d687af27207f0f55520d0eb20abd14870eb198 | |
parent | 28dc5085dd2edaf55746a1c52fe2da2595ef372d (diff) |
Add a few headers
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@256 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
-rwxr-xr-x | split-mailman-mails-and-discard-and-save | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/split-mailman-mails-and-discard-and-save b/split-mailman-mails-and-discard-and-save index eb00669..181dd1c 100755 --- a/split-mailman-mails-and-discard-and-save +++ b/split-mailman-mails-and-discard-and-save @@ -23,12 +23,13 @@ SA_SCORE_SUFFICIENT = 10.0 OUTBOX = "mail/outbox" SPAMLEARN = "mail/spam-learn" HAMLEARN = "mail/ham-learn" +ERRORBOX = "mail/errors" check_maildir OUTBOX +check_maildir ERRORBOX check_maildir SPAMLEARN check_maildir HAMLEARN APPROVE_PASSWORD = YAML::load( File.open( 'mailman-passwords.yaml' ) ) -ERRORBOX = "mail/errors" if ARGV[0] == "spam" ACTION = "spam" @@ -100,6 +101,8 @@ def handle_mailman_queued_mail(cookie, request_address, password) mail_request = RMail::Message.new() mail_request.header['From'] = FROM mail_request.header['To'] = request_address + mail_request.header['X-Listbot-Domain'] = DOMAIN + mail_request.header['X-Listbot-Type'] = 'Mailman-Request' mail_request.header['Subject'] = "Re: confirm #{cookie}" mail_request.header['Approved'] = password if password mail_request.body = '' @@ -113,6 +116,8 @@ def approve(cookie, request_address) mail_error = RMail::Message.new() mail_error.header['From'] = FROM mail_error.header['To'] = ERRORSTO + mail_error.header['X-Listbot-Domain'] = DOMAIN + mail_error.header['X-Listbot-Type'] = 'Error' mail_error.header['Subject'] = "approving #{cookie} failed" mail_error.body = 'Sorry, this script does not have the admin/moderator password for'+"\n#{request_address}." store_in_maildir(OUTBOX, mail_error) @@ -219,6 +224,8 @@ def send_ack(action, resent_info) mail.header['From'] = FROM mail.header['To'] = ERRORSTO mail.header['Subject'] = "#{action} by #{resent_info['from']}" + mail.header['X-Listbot-Domain'] = DOMAIN + mail.header['X-Listbot-Type'] = 'Acknowledgement' mail.header['In-Reply-To'] = resent_info['origmsgid'] mail.header['References'] = resent_info['origmsgid']+' '+resent_info['msgid'] mail.body = "On #{resent_info['date']} #{resent_info['from']} #{action} this message.\n" + @@ -294,6 +301,8 @@ def process_mail(filename) new_m << line.gsub(/^Delivered-To:/, 'X-OLD-Delivered-To:') end new_m.concat m + new_m.header['X-Listbot-Domain'] = DOMAIN + new_m.header['X-Listbot-Type'] = 'Moderator-Request' store_in_maildir(OUTBOX_HUMANS, new_m.join("\n")) end else @@ -312,6 +321,8 @@ Dir[MAILIN+"/new/*"].each do |filename| mail_error = RMail::Message.new() mail_error.header['From'] = FROM mail_error.header['To'] = ERRORSTO + mail_error.header['X-Listbot-Domain'] = DOMAIN + mail_error.header['X-Listbot-Type'] = 'Error' mail_error.header['Subject'] = "handling of #{filename} failed" mail_error.body = "Processing of #{filename} failed: #{e}\n" + "Moved to #{newname}" |