From 0d22774a9ed34bb92a84ef091a8db9c7703edfc7 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Mon, 19 Feb 2007 11:48:11 +0000 Subject: Add a few headers git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@256 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- split-mailman-mails-and-discard-and-save | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'split-mailman-mails-and-discard-and-save') 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}" -- cgit v1.2.3