Difference between revisions of "Mailman 3 Shell"

From Run Your Own
Jump to: navigation, search
(Troubleshooting)
Line 6: Line 6:
 
* become the mailman
 
* become the mailman
 
  su mailman
 
  su mailman
* go home (important!)
+
* go to the venv home (important!)
  cd
+
  cd ~/env
 
* 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 15:
 
  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>
  
 
[[Category:Email]]
 
[[Category:Email]]

Revision as of 12:09, 19 July 2023

Mailman 3 comes with a shell that allows to work directly on a list from Python's REPL. Use it wisely.

Troubleshooting

Change the default max email size

At time of writing Mailman 3.1.1 suffers from several bugs and incomplete API features and interfacing from Postorius, that prevent changing the default super tiny max email size limit of 40K. That can be a problem as some emails, specifically piece of crap bloated HTML newsletters, easily go beyond this limit. More problematic, sharing files, even small files is just impossible. Starting with Mailman 3.2.x it will be possible to change the max size limit directly from the web interface (right now it does nothing). But for now, this is only possible via the Mailman 3 shell:

  • become the mailman
su mailman
  • go to the venv home (important!)
cd ~/env
  • 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>