#contents
*非会員アドレスが return-path にあるとshuntする問題 [#y98acdb2]
https://mail.python.org/pipermail/mailman-users/2005-June/045422.html
/usr/local/mailman/Mailman/Handlers/SMTPDirect.py
del msg['errors-to']
del msg['return-path']
msg['Errors-To'] = envsender
del msg['return-path'] の一行を追加してみた。
*Anonymouse List の From: へ「(氏名)Full_name」を表示したい 2018年2月7日最終版 [#o6bcd1af]
2018/02/05配布の、ja-mailman-2.1.14.j7_2,1 についての改変
/usr/local/mailman/Mailman/Handlers/Cleanse.py をパッチするだけでOK!?
Cleanse.diff
--- Cleanse.py_dist 2011-10-30 07:02:40.000000000 +0900
+++ Cleanse.py 2011-10-30 07:03:40.000000000 +0900
@@ -1,5 +1,5 @@
-# Copyright (C) 1998-2010 by the Free Software Foundation, Inc.
-#
+# Copyright (C) 1998-2006 by the Free Software Foundation, Inc.
+# NAGAE version
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
@@ -53,8 +53,17 @@
# And so can the message-id so replace it.
del msg['message-id']
msg['Message-ID'] = unique_message_id(mlist)
+
+ for sender in msg.get_senders():
+ if mlist.isMember(sender):
+ break
+ else:
+ sender = msg.get_sender()
+ i18ndesc = str(uheader(mlist, mlist.getMemberName(sender), 'From'))
+ if i18ndesc == '':
i18ndesc = str(uheader(mlist, mlist.description, 'From'))
msg['From'] = formataddr((i18ndesc, mlist.GetListEmail()))
+
msg['Reply-To'] = mlist.GetListEmail()
uf = msg.get_unixfrom()
if uf:
----
*Anonymouse List の From: へ「(氏名)Full_name」を表示したい [#w50ae22f]
20111028
Mailman 2.1.14 /usr/local/mailman/Mailman/Handlers/Cleanse.py
# Copyright (C) 1998-2006 by the Free Software Foundation, Inc.
# NAGAE version
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
"""Cleanse certain headers from all messages."""
import re
from email.Utils import formataddr
from Mailman.Utils import unique_message_id
from Mailman.Logging.Syslog import syslog
from Mailman.Handlers.CookHeaders import uheader
def process(mlist, msg, msgdata):
# Always remove this header from any outgoing messages. Be sure to do
# this after the information on the header is actually used, but before a
# permanent record of the header is saved.
del msg['approved']
# Remove this one too.
del msg['approve']
# And these too.
del msg['x-approved']
del msg['x-approve']
# Also remove this header since it can contain a password
del msg['urgent']
# We remove other headers from anonymous lists
if mlist.anonymous_list:
syslog('post', 'post to %s from %s anonymized',
mlist.internal_name(), msg.get('from'))
del msg['from']
del msg['reply-to']
del msg['sender']
del msg['return-path']
# Hotmail sets this one
del msg['x-originating-email']
# And these can reveal the sender too
del msg['received']
# And so can the message-id so replace it.
del msg['message-id']
msg['Message-ID'] = unique_message_id(mlist)
for sender in msg.get_senders():
if mlist.isMember(sender):
break
else:
sender = msg.get_sender()
i18ndesc = str(uheader(mlist, mlist.getMemberName(sender), 'From'))
if i18ndesc == '':
i18ndesc = str(uheader(mlist, mlist.description, 'From'))
msg['From'] = formataddr((i18ndesc, mlist.GetListEmail()))
msg['Reply-To'] = mlist.GetListEmail()
uf = msg.get_unixfrom()
if uf:
uf = re.sub(r'\S*@\S*', mlist.GetListEmail(), uf)
msg.set_unixfrom(uf)
# Some headers can be used to fish for membership
del msg['return-receipt-to']
del msg['disposition-notification-to']
del msg['x-confirm-reading-to']
# Pegasus mail uses this one... sigh
del msg['x-pmrqc']
http://mm.tkikuchi.net/pipermail/mmjp-users/2007-June/002086.html
**mail addressは隠したいが氏名を表示したい。 [#se89f1b5]
A:他で anonymous_list を利用していないのであれば、anonymous_list
の挙動そのものを変更するというのはどうでしょうか?
http://mailman.svn.sourceforge.net/viewvc/mailman/tags/Release_2_1_9/Mailman/Handlers/Cleanse.py?view=markup
のソースでいうと、
39行目の del msg['from'] の前に、
from email.Utils import parseaddr
senderfullname = parseaddr(msg.get('from'))[0]
を挿入、45行目を
msg['From'] = formataddr((senderfullname, mlist.GetListEmail()))
に変更。
試してないので、うまくいくかどうかわかりませんが。
菊地時夫
**From: へ「(氏名)Full_name」を表示したい [#sf7b7ea5]
http://mm.tkikuchi.net/pipermail/mmjp-users/2007-October/002171.html
はじめまして。永江と申します。
このたび Mailman を使ってメーリングリストを作成したのですが、
anonymous_list の挙動が希望に合わなかったのでパッチを作成しました。
ご意見いただけると幸いです。
私の希望としては、保存書庫は公開したいのですが、メンバーの
メールアドレスは(部外者には)公開したくないというものでした。
anonymous_list を設定すると、送信者関係のヘッダはメーリングリスト
自身になるよう設定されます。私の希望と比較すると、これはやりすぎで、
メールアドレスだけ隠して、どのメンバーから送信されたかわかる程度の
情報は残したいのです。特に保存書庫の一覧表示で、差出人として
リスト定義の description の文字列が並ぶのはいただけません。
検討した結果、メールアドレスは現在の挙動のままとして、
description のかわりに、会員情報として登録した realname をつける
ことにしました。
Mailman 2.1.9 には、このような設定は用意されていないようだったので、
添付のパッチを適用しています。簡単にするために anonymous_list の
処理を上書きしてしまいましたが、0/1 に加えて第 3 のオプションとして
提供されるのがベターだと思っています。
「実はパッチなしでも実現できる」「そのパッチはこう修正すべき」
「そもそもの考えがおかしい」などなどご意見あればお聞かせください。
よろしくお願いします。
# 特に Python を書くのは初めてなので言語的に変かもしれません
*** mailman-2.1.9/Mailman/Handlers/Cleanse.py.orig Mon Jan 16 06:01:35 2006
--- mailman-2.1.9/Mailman/Handlers/Cleanse.py Sun Sep 30 17:53:54 2007
***************
*** 41,47 ****
del msg['sender']
# Hotmail sets this one
del msg['x-originating-email']
! i18ndesc = str(uheader(mlist, mlist.description, 'From'))
msg['From'] = formataddr((i18ndesc, mlist.GetListEmail()))
msg['Reply-To'] = mlist.GetListEmail()
# Some headers can be used to fish for membership
--- 41,54 ----
del msg['sender']
# Hotmail sets this one
del msg['x-originating-email']
! for sender in msg.get_senders():
! if mlist.isMember(sender):
! break
! else:
! sender = msg.get_sender()
! i18ndesc = str(uheader(mlist, mlist.getMemberName(sender), 'From'))
! if i18ndesc == '':
! i18ndesc = str(uheader(mlist, mlist.description, 'From'))
msg['From'] = formataddr((i18ndesc, mlist.GetListEmail()))
msg['Reply-To'] = mlist.GetListEmail()
# Some headers can be used to fish for membership
http://mm.tkikuchi.net/pipermail/mmjp-users/2008-February/002339.html
http://mm.tkikuchi.net/pipermail/mmjp-users/2008-February/002338.html
anonymous_list を使うと、書庫がすべて同じ送信者名になるので、
やり取りを理解しにくくなるのが難点です。
[mmjp-users 2171] で書いたとおり、リスト単位の設定を考えると
anonymous_list に選択肢を追加するのが良さそうなのですが、
Web の管理画面なども含めて考えるとなかなか手が出ません。
永江 英武 nagae @ xxxxxxxx
Nagae Hidetake http://www.eagan.jp/nagae/
-------------- next part --------------
*** Mailman/Handlers/Cleanse.py.orig Mon Jan 16 06:01:35 2006
--- Mailman/Handlers/Cleanse.py Thu Feb 28 20:52:46 2008
***************
*** 32,37 ****
--- 32,38 ----
del msg['approve']
# Also remove this header since it can contain a password
del msg['urgent']
+ msgdata['orig-sender'] = msg.get('from')
# We remove other headers from anonymous lists
if mlist.anonymous_list:
syslog('post', 'post to %s from %s anonymized',
*** Mailman/Handlers/Decorate.py.orig Sat Jun 24 05:03:32 2006
--- Mailman/Handlers/Decorate.py Fri Feb 29 06:09:18 2008
***************
*** 41,46 ****
--- 41,57 ----
if msgdata.get('isdigest') or msgdata.get('nodecorate'):
return
d = {}
+ lcset = Utils.GetCharSet(mlist.preferred_language)
+ from email.Utils import parseaddr
+ sender_parsed = parseaddr(msgdata['orig-sender'])
+ d['sender_address'] = sender_parsed[1]
+ d['sender_fullname'] = d['sender_address']
+ if sender_parsed[0] != '':
+ d['sender_fullname'] = Utils.oneline(sender_parsed[0], lcset)
+ d['sender_nickname'] = d['sender_fullname']
+ if mlist.isMember(sender_parsed[1]):
+ if mlist.getMemberName(sender_parsed[1]) != None:
+ d['sender_nickname'] = mlist.getMemberName(sender_parsed[1])
if msgdata.get('personalize'):
# Calculate the extra personalization dictionary. Note that the
# length of the recips list better be exactly 1.
*** Mailman/Gui/Digest.py.orig Sat Aug 27 10:40:17 2005
--- Mailman/Gui/Digest.py Thu Feb 28 20:49:49 2008
***************
*** 27,32 ****
--- 27,33 ----
# to this.
ALLOWEDS = ('real_name', 'list_name', 'host_name', 'web_page_url',
'description', 'info', 'cgiext', '_internal_name',
+ 'sender_fullname', 'sender_address', 'sender_nickname',
)
*From: へ「(氏名)Full_name」を表示したい [#o20211ef]
http://mm.tkikuchi.net/pipermail/mmjp-users/2008-February/002339.html
-------------- next part --------------
*** Mailman/Handlers/Cleanse.py.orig Mon Jan 16 06:01:35 2006
--- Mailman/Handlers/Cleanse.py Thu Feb 28 20:52:46 2008
***************
*** 32,37 ****
--- 32,38 ----
del msg['approve']
# Also remove this header since it can contain a password
del msg['urgent']
+ msgdata['orig-sender'] = msg.get('from')
# We remove other headers from anonymous lists
if mlist.anonymous_list:
syslog('post', 'post to %s from %s anonymized',
*** Mailman/Handlers/Decorate.py.orig Sun Sep 30 16:11:02 2007
--- Mailman/Handlers/Decorate.py Fri Feb 29 06:40:05 2008
***************
*** 41,46 ****
--- 41,61 ----
if msgdata.get('isdigest') or msgdata.get('nodecorate'):
return
d = {}
+ lcset = Utils.GetCharSet(mlist.preferred_language)
+ from email.Utils import parseaddr
+ sender_parsed = parseaddr(msgdata['orig-sender'])
+ d['sender_address'] = sender_parsed[1]
+ d['sender_fullname'] = d['sender_address']
+ if sender_parsed[0] != '':
+ d['sender_fullname'] = Utils.oneline(sender_parsed[0], lcset)
+ d['sender_nickname'] = d['sender_fullname']
+ if mlist.isMember(sender_parsed[1]):
+ nickname = mlist.getMemberName(sender_parsed[1])
+ if nickname != None and nickname != '':
+ try:
+ d['sender_nickname'] = nickname.encode(lcset)
+ except (AttributeError, UnicodeError):
+ d['sender_nickname'] = d['sender_fullname']
if msgdata.get('personalize'):
# Calculate the extra personalization dictionary. Note that the
# length of the recips list better be exactly 1.
*** Mailman/Gui/Digest.py.orig Sat Aug 27 10:40:17 2005
--- Mailman/Gui/Digest.py Thu Feb 28 20:49:49 2008
***************
*** 27,32 ****
--- 27,33 ----
# to this.
ALLOWEDS = ('real_name', 'list_name', 'host_name', 'web_page_url',
'description', 'info', 'cgiext', '_internal_name',
+ 'sender_fullname', 'sender_address', 'sender_nickname',
)
***移行作業履歴 [#c6254811]
1018 16:05 cp /usr/Backups/Guard/usr/local/mailman/Mailman/Handlers/Cleanse.py_TFC /usr/local/mailman/Mailman/Handlers/
1019 16:08 cp /usr/local/mailman/Mailman/Handlers/Cleanse.py /usr/local/mailman/Mailman/Handlers/Cleanse.py_dist
1020 16:09 diff /usr/Backups/Guard/usr/local/mailman/Mailman/Handlers/Cleanse.py_dist /usr/local/mailman/Mailman/Handlers/Cleanse.py_dist
1021 16:10 cp /usr/local/mailman/Mailman/Handlers/Cleanse.py_TFC /usr/local/mailman/Mailman/Handlers/Cleanse.py
1022 16:11 history
----
#counter([total|today|yesterday]);
RIGHT:&lastmod;更新
----