Mailman Tips 5
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*Mailman Tips 5 [#h0f05d31]
[[Mailman on FreeBSD]]~
[[Mailman Tips]]~
[[Mailman Tips 2]]~
[[Mailman Tips 3]]~
[[Mailman Tips 4]]~
#contents
**mailmanのmsg_header の変更 [#xca0562c]
【環境】
FreeBSD 6.3-p6 Postfix(2.3.8) Mailman(version 2.1.9)
○通し番号カスタマイズ○本文機種文字対策菊地先生方式^^
○[mmjp-users 2258] 添付のMIMESubject.patch(by Nagae様)...
【やりたいこと】
メール本文中に表示されるヘッダ、msg_header を指定した時...
たい。というものです。
MailmanのGUIな操作で「メーリングリスト管理」>「普通配送...
普通配送会員へのメールに付けるヘッダ
(msg_headerの詳細)
で設定変更出来ますが、これをコマンドラインなどからcron ...
日の24時00分に(各ML一斉に)変更したい、などと考えていま...
どのような方法がありますでしょうか。あるいは、すでに実装...
能でしょうか。
リストの設定をコマンドラインから操作するには
Mailman 付属ユーティリティの withlist が使えます。
例えばこんなスクリプトを用意しておいて
change_header.py:
def change_header(mlist):
mlist.Lock()
mlist.msg_header = "[%s %%d]" % mlist.real_name
mlist.Save()
$ sudo -u mailman bin/withlist -a -r change_header
とでも与えて実行すれば全リストの msg_header が書き変わ
るはずです。
個別のMLの場合で日本語での複数行ヘッダの場合
cat change_header_1.py
#! /usr/bin/env python
#-*- coding: euc-jp -*-
def change_header_1(m):
m.msg_header = "┏━━━━━━━━━━\n┃あいうえ日本語\n┗━...
m.Save()
等と表記して、文字コードをeucで保存して
# /usr/local/mailman/bin/withlist -l -r change_header_1 ...
すると
┏━━━━━━━━━━
┃あいうえ日本語
┗━━━━━━━━━━
の様に変更され表示されます。:-)
% ./withlist -h
General framework for interacting with a mailing list ob...
There are two ways to use this script: interactively or ...
Using it interactively allows you to play with, examine ...
object from Python's interactive interpreter. When runn...
MailList object called `m' will be available in the glob...
loads the class MailList into the global namespace.
Programmatically, you can write a function to operate on...
and this script will take care of the housekeeping (see ...
In that case, the general usage syntax is:
% bin/withlist [options] listname [args ...]
Options:
-l / --lock
Lock the list when opening. Normally the list is...
(e.g. for read-only operations). You can always ...
the fact by typing `m.Lock()'
Note that if you use this option, you should expl...
before exiting, since the interpreter's clean up ...
automatically save changes to the MailList object...
the list).
-i / --interactive
Leaves you at an interactive prompt after all oth...
complete. This is the default unless the -r opti...
--run [module.]callable
-r [module.]callable
This can be used to run a script with the opened ...
This works by attempting to import `module' (whic...
directory containing withlist, or already be acce...
sys.path), and then calling `callable' from the m...
be a class or function; it is called with the Mai...
first argument. If additional args are given on ...
they are passed as subsequent positional args to ...
Note that `module.' is optional; if it is omitted...
the name `callable' will be imported.
The global variable `r' will be set to the result...
--all / -a
This option only works with the -r option. Use t...
execute the script on all mailing lists. When yo...
not include a listname argument on the command li...
will be a list of all the results.
--quiet / -q
Suppress all status messages.
--help / -h
Print this message and exit
Here's an example of how to use the -r option. Say you ...
Mailman installation directory called `listaddr.py', wit...
two functions:
def listaddr(mlist):
print mlist.GetListEmail()
def requestaddr(mlist):
print mlist.GetRequestEmail()
Now, from the command line you can print the list's post...
the following from the command line:
% bin/withlist -r listaddr mylist
Loading list: mylist (unlocked)
Importing listaddr ...
Running listaddr.listaddr() ...
mylist@myhost.com
And you can print the list's request address by running:
% bin/withlist -r listaddr.requestaddr mylist
Loading list: mylist (unlocked)
Importing listaddr ...
Running listaddr.requestaddr() ...
mylist-request@myhost.com
As another example, say you wanted to change the passwor...
user on a particular list. You could put the following ...
called `changepw.py':
from Mailman.Errors import NotAMemberError
def changepw(mlist, addr, newpasswd):
try:
mlist.setMemberPassword(addr, newpasswd)
mlist.Save()
except NotAMemberError:
print 'No address matched:', addr
and run this from the command line:
% bin/withlist -l -r changepw mylist somebody@somewhere....
----
#counter([total|today|yesterday]);
終了行:
*Mailman Tips 5 [#h0f05d31]
[[Mailman on FreeBSD]]~
[[Mailman Tips]]~
[[Mailman Tips 2]]~
[[Mailman Tips 3]]~
[[Mailman Tips 4]]~
#contents
**mailmanのmsg_header の変更 [#xca0562c]
【環境】
FreeBSD 6.3-p6 Postfix(2.3.8) Mailman(version 2.1.9)
○通し番号カスタマイズ○本文機種文字対策菊地先生方式^^
○[mmjp-users 2258] 添付のMIMESubject.patch(by Nagae様)...
【やりたいこと】
メール本文中に表示されるヘッダ、msg_header を指定した時...
たい。というものです。
MailmanのGUIな操作で「メーリングリスト管理」>「普通配送...
普通配送会員へのメールに付けるヘッダ
(msg_headerの詳細)
で設定変更出来ますが、これをコマンドラインなどからcron ...
日の24時00分に(各ML一斉に)変更したい、などと考えていま...
どのような方法がありますでしょうか。あるいは、すでに実装...
能でしょうか。
リストの設定をコマンドラインから操作するには
Mailman 付属ユーティリティの withlist が使えます。
例えばこんなスクリプトを用意しておいて
change_header.py:
def change_header(mlist):
mlist.Lock()
mlist.msg_header = "[%s %%d]" % mlist.real_name
mlist.Save()
$ sudo -u mailman bin/withlist -a -r change_header
とでも与えて実行すれば全リストの msg_header が書き変わ
るはずです。
個別のMLの場合で日本語での複数行ヘッダの場合
cat change_header_1.py
#! /usr/bin/env python
#-*- coding: euc-jp -*-
def change_header_1(m):
m.msg_header = "┏━━━━━━━━━━\n┃あいうえ日本語\n┗━...
m.Save()
等と表記して、文字コードをeucで保存して
# /usr/local/mailman/bin/withlist -l -r change_header_1 ...
すると
┏━━━━━━━━━━
┃あいうえ日本語
┗━━━━━━━━━━
の様に変更され表示されます。:-)
% ./withlist -h
General framework for interacting with a mailing list ob...
There are two ways to use this script: interactively or ...
Using it interactively allows you to play with, examine ...
object from Python's interactive interpreter. When runn...
MailList object called `m' will be available in the glob...
loads the class MailList into the global namespace.
Programmatically, you can write a function to operate on...
and this script will take care of the housekeeping (see ...
In that case, the general usage syntax is:
% bin/withlist [options] listname [args ...]
Options:
-l / --lock
Lock the list when opening. Normally the list is...
(e.g. for read-only operations). You can always ...
the fact by typing `m.Lock()'
Note that if you use this option, you should expl...
before exiting, since the interpreter's clean up ...
automatically save changes to the MailList object...
the list).
-i / --interactive
Leaves you at an interactive prompt after all oth...
complete. This is the default unless the -r opti...
--run [module.]callable
-r [module.]callable
This can be used to run a script with the opened ...
This works by attempting to import `module' (whic...
directory containing withlist, or already be acce...
sys.path), and then calling `callable' from the m...
be a class or function; it is called with the Mai...
first argument. If additional args are given on ...
they are passed as subsequent positional args to ...
Note that `module.' is optional; if it is omitted...
the name `callable' will be imported.
The global variable `r' will be set to the result...
--all / -a
This option only works with the -r option. Use t...
execute the script on all mailing lists. When yo...
not include a listname argument on the command li...
will be a list of all the results.
--quiet / -q
Suppress all status messages.
--help / -h
Print this message and exit
Here's an example of how to use the -r option. Say you ...
Mailman installation directory called `listaddr.py', wit...
two functions:
def listaddr(mlist):
print mlist.GetListEmail()
def requestaddr(mlist):
print mlist.GetRequestEmail()
Now, from the command line you can print the list's post...
the following from the command line:
% bin/withlist -r listaddr mylist
Loading list: mylist (unlocked)
Importing listaddr ...
Running listaddr.listaddr() ...
mylist@myhost.com
And you can print the list's request address by running:
% bin/withlist -r listaddr.requestaddr mylist
Loading list: mylist (unlocked)
Importing listaddr ...
Running listaddr.requestaddr() ...
mylist-request@myhost.com
As another example, say you wanted to change the passwor...
user on a particular list. You could put the following ...
called `changepw.py':
from Mailman.Errors import NotAMemberError
def changepw(mlist, addr, newpasswd):
try:
mlist.setMemberPassword(addr, newpasswd)
mlist.Save()
except NotAMemberError:
print 'No address matched:', addr
and run this from the command line:
% bin/withlist -l -r changepw mylist somebody@somewhere....
----
#counter([total|today|yesterday]);
ページ名: