summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authormailman1998-02-27 16:10:31 +0000
committermailman1998-02-27 16:10:31 +0000
commit46d178b98b5ae3c6b164258bdba01b9598cc73dc (patch)
tree26641a348a8a51a120524bebc3e347488901f738 /scripts
parent34424e63e8008c267dd7eeaf15c6453e246ec966 (diff)
downloadmailman-46d178b98b5ae3c6b164258bdba01b9598cc73dc.tar.gz
mailman-46d178b98b5ae3c6b164258bdba01b9598cc73dc.tar.zst
mailman-46d178b98b5ae3c6b164258bdba01b9598cc73dc.zip
Initial revision
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/answer_majordomo_mail25
-rwxr-xr-xscripts/mailowner26
-rwxr-xr-xscripts/owner26
-rwxr-xr-xscripts/post69
4 files changed, 146 insertions, 0 deletions
diff --git a/scripts/answer_majordomo_mail b/scripts/answer_majordomo_mail
new file mode 100755
index 000000000..d063de234
--- /dev/null
+++ b/scripts/answer_majordomo_mail
@@ -0,0 +1,25 @@
+#!/usr/local/bin/python
+# This is another script that's really just for my use, but
+# feel free to use it if you know how...
+
+import sys
+
+f = open('/tmp/md.err', 'a+')
+sys.stderr = f
+
+sys.path.append('/home/mailman/mailman/modules')
+
+import mm_message, mm_deliver
+
+msg = mm_message.IncomingMessage()
+
+text = open('/home/mailman/mailman/misc/majordomo.answer.txt', 'r').read()
+
+class MyDeliverer(mm_deliver.Deliverer):
+ def GetAdminEmail(self):
+ return "mailman-owner"
+
+d = MyDeliverer()
+
+d.SendTextToUser('Your mail to Majordomo...', text, msg.GetSender(),
+ 'mailman-owner')
diff --git a/scripts/mailowner b/scripts/mailowner
new file mode 100755
index 000000000..746dc8008
--- /dev/null
+++ b/scripts/mailowner
@@ -0,0 +1,26 @@
+#! /usr/local/bin/python
+#
+# This script gets called by the wrapper.
+# Stdin is the mail message, and argv[1] is the name of the mailing list
+# whose owner(s) to send mail to.
+
+import sys
+f = open('/tmp/owner.errs', 'a+')
+sys.stderr = f
+
+sys.path.append('/home/mailman/mailman/modules')
+
+import maillist, mm_message
+
+# Only let one program run at once per list.
+
+# TODO: This *can* fail, and should send back an error message when it does.
+current_list = maillist.MailList(sys.argv[1])
+try:
+ msg = mm_message.IncomingMessage()
+ if not current_list.bounce_processing or not current_list.ScanMessage(msg):
+ current_list.DeliverToList(msg, current_list.owner, '', '')
+# Let another process run.
+finally:
+ current_list.Unlock()
+
diff --git a/scripts/owner b/scripts/owner
new file mode 100755
index 000000000..746dc8008
--- /dev/null
+++ b/scripts/owner
@@ -0,0 +1,26 @@
+#! /usr/local/bin/python
+#
+# This script gets called by the wrapper.
+# Stdin is the mail message, and argv[1] is the name of the mailing list
+# whose owner(s) to send mail to.
+
+import sys
+f = open('/tmp/owner.errs', 'a+')
+sys.stderr = f
+
+sys.path.append('/home/mailman/mailman/modules')
+
+import maillist, mm_message
+
+# Only let one program run at once per list.
+
+# TODO: This *can* fail, and should send back an error message when it does.
+current_list = maillist.MailList(sys.argv[1])
+try:
+ msg = mm_message.IncomingMessage()
+ if not current_list.bounce_processing or not current_list.ScanMessage(msg):
+ current_list.DeliverToList(msg, current_list.owner, '', '')
+# Let another process run.
+finally:
+ current_list.Unlock()
+
diff --git a/scripts/post b/scripts/post
new file mode 100755
index 000000000..4eac017c6
--- /dev/null
+++ b/scripts/post
@@ -0,0 +1,69 @@
+#! /usr/local/bin/python
+#
+# This script gets called by the wrapper.
+# Stdin is the mail message, and argv[1] is the name of the mailing list
+# being posted to.
+# Todo: check size of To: list < 100
+# Send back why the post was rejected.
+
+import sys
+f = open('/tmp/hmm2', 'a+')
+sys.stderr = f
+
+sys.path.append('/home/mailman/mailman/modules')
+
+import maillist, mm_message, mm_err, mm_cfg
+
+# Only let one program run at once per list.
+
+# TODO: This can fail, and should send back an error message when it does.
+current_list = maillist.MailList(sys.argv[1])
+
+try:
+ prog = current_list.filter_prog
+ if prog:
+ import os, __main__
+ file = os.path.join('/home/mailman/mailman/filters', prog)
+ try:
+ execfile(file)
+ text = __main__.mailman_text
+ except:
+ text = sys.stdin.read()
+ else:
+ text = sys.stdin.read()
+ msg = mm_message.IncomingMessage(text)
+
+ try:
+ current_list.Post(msg)
+ except mm_err.MMNeedApproval, err_msg:
+ if current_list.dont_respond_to_post_requests:
+ sys.exit(0)
+ the_sender = msg.GetSender()
+ subj = msg.getheader('subject')
+ if not subj:
+ subj = '[no subject]'
+ body = '''
+Your mail to '%s' with the subject:
+
+%s
+
+Is being held until the list moderator can review it for approval.
+The reason why it is being held is:
+
+ %s
+
+Either the message will get posted to the list, or you will receive
+notification of the moderator's decison.
+''' % (current_list.real_name, subj, err_msg)
+
+ current_list.SendTextToUser( subject = 'Mail sent to %s' %
+ current_list.real_name,
+ recipient = the_sender,
+ text = body)
+# Let another process run.
+finally:
+ current_list.Unlock()
+
+
+
+