Difference between revisions of "Mailing list"

1,521 bytes added ,  13:26, 11 March 2021
How to combat spam
(add more dkim validator services)
(How to combat spam)
Line 47: Line 47:


/usr/sbin/sendmail -t < dkim-test.txt
/usr/sbin/sendmail -t < dkim-test.txt
== Remove spam confirmation requests ==
Too many pending subscription requests can slow down[https://gitlab.com/mailman/postorius/-/issues/417] list index. Updating postorius is how to fix this. But in case there's no other way, and removing those requests through frontend [https://gitlab.com/mailman/mailman/-/issues/779#note_423132958] is impossible, this can be done:
$ sudo mailman shell -l listname.lists.fsci.org.in
Welcome to the GNU Mailman shell
The variable 'm' is the listname@lists.fsci.org.in mailing list
>>> from zope.component import getUtility
>>> from mailman.interfaces.pending import IPendings
>>> pendings = getUtility(IPendings)
>>> plist = []
>>> for p in pendings.find(m):
...  plist.append(p)
...
>>> len(plist)
2047
>>> # Let us save the spammer email and when they signed up for analysis
>>> import csv
>>> with open('spam.csv', 'w', newline='') as csvfile:
...    spamwriter = csv.writer(csvfile, delimiter=',')
...    for p in plist:
...        spammer = p[1]
...        spamwriter.writerow([spammer.get('email'), spammer.get('when'), spammer.get('display_name')])
...
>>> # Now on to actually removing spam
>>> from mailman.interfaces.workflow import IWorkflowStateManager
>>> workflow = getUtility(IWorkflowStateManager)
>>> for p in plist:
...    token = p[0]
...    pendings.confirm(token)
...    workflow.discard(token)
...
>>> # Now, we have to commit this transaction to database
>>> from mailman.config import config
>>> config.db.commit()


----
----


[[Category: Services]]
[[Category: Services]]