Difference between revisions of "Mailman 3 Shell"
(→Step by step example: change the size of message attachments) |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
== Troubleshooting == | == Troubleshooting == | ||
− | === | + | === Step by step example: change the size of message attachments === |
− | |||
* become the mailman | * become the mailman | ||
su mailman | su mailman | ||
− | * go home (important!) | + | * go to the venv home (important!) |
− | cd | + | cd we.lurk.org/venv |
* start the shell with the list, the settings of which you want to edit: | * start the shell with the list, the settings of which you want to edit: | ||
mailman withlist mylist@we.lurk.org | mailman withlist mylist@we.lurk.org | ||
Line 15: | Line 14: | ||
exit() # or Ctrl-D | exit() # or Ctrl-D | ||
* Done! Enjoy your mailchimp forwards! | * Done! Enjoy your mailchimp forwards! | ||
+ | |||
+ | === List all the subscribed emails from all lists === | ||
+ | su mailman | ||
+ | cd ~/env | ||
+ | mailman shell | ||
+ | >>> lm = getUtility(IListManager) | ||
+ | >>> for mlist in lm.mailing_lists: | ||
+ | ... for member in mlist.members.members: | ||
+ | ... print(member.address.email, mlist.list_name) | ||
+ | ... | ||
+ | <lots of stuff> | ||
+ | |||
+ | === Re-enable accounts that have been disabled for excess bounce === | ||
+ | su mailman | ||
+ | cd ~/env | ||
+ | mailman shell -l listname@we.lurk.org | ||
+ | >>> for member in m.members.members: | ||
+ | ... if member.delivery_status == DeliveryStatus.by_bounces: | ||
+ | ... member.preferences.delivery_status = DeliveryStatus.enabled | ||
+ | ... print("Re-enabled delivery for bouncing member {} on list {}" | ||
+ | ... .format(member.address.email, mlist.list_name)) | ||
+ | ... | ||
+ | <lots of stuff> | ||
+ | >>> commit() | ||
+ | >>> exit() | ||
[[Category:Email]] | [[Category:Email]] |
Latest revision as of 01:48, 2 January 2024
Mailman 3 comes with a shell that allows to work directly on a list from Python's REPL. Use it wisely.
Contents
Troubleshooting
Step by step example: change the size of message attachments
- become the mailman
su mailman
- go to the venv home (important!)
cd we.lurk.org/venv
- start the shell with the list, the settings of which you want to edit:
mailman withlist mylist@we.lurk.org
- assign new value to max_message_size. Each unit is 1024 bytes, so 500K would be simply
m.max_message_size = 500
- quit the shell
exit() # or Ctrl-D
- Done! Enjoy your mailchimp forwards!
List all the subscribed emails from all lists
su mailman cd ~/env mailman shell >>> lm = getUtility(IListManager) >>> for mlist in lm.mailing_lists: ... for member in mlist.members.members: ... print(member.address.email, mlist.list_name) ... <lots of stuff>
Re-enable accounts that have been disabled for excess bounce
su mailman cd ~/env mailman shell -l listname@we.lurk.org >>> for member in m.members.members: ... if member.delivery_status == DeliveryStatus.by_bounces: ... member.preferences.delivery_status = DeliveryStatus.enabled ... print("Re-enabled delivery for bouncing member {} on list {}" ... .format(member.address.email, mlist.list_name)) ... <lots of stuff> >>> commit() >>> exit()