It would be nice to have a maintenance script for sending batches of email messages for the Tool Labs annual survey and other similar one-off mailing list events. This topic comes up from time to time and there is always a random scramble to find a way to send the messages that won't result in a higher than normal spam classification or getting the WMF mail relays put on a bouncelist of some kind.
This script should make sure that bounces come back to the wiki so bounce handlers are notified.
It would be extra awesome if we added a bulk-mailing opt-out user preference and a special page that toggled it so that the emails could include a List-Unsubscribe header pointing to the special page. The "If you do not wish to receive future annual survey emails from the Tool Labs team, uncheck 'Enable email from other users'" item from the 2015 and 2016 surveys is not user friendly at all.
@Legoktm would it be crazy to implement the functionality of https://www.mediawiki.org/wiki/Extension:MassMessageEmail directly in https://www.mediawiki.org/wiki/Extension:MassMessage as something that could be toggled per-message if allowed by wiki config? This would give a UI for bulk mailing and an opt-out system basically for basically free.
Well, you'd have to opt out from all mass messages, which seems a bit overboard (although in general the ability to send email or even better Echo notifications with MassMessage would be nice). Why not use the Newsletter extension for this? Seems like the exact use case it was meant for.
It's not clear to me if Newsletter can send an email to a list that is not content also published on the wiki.
A "newsletter" is defined as a publication that has a name, a wiki home page, and a single or central wiki page for each issue or edition. -- Extension:Newsletter
What I really want is:
- Maintenance script that can send an email to given list of wiki account holders
- Ability to check for an 'opt-out' signal for on each targeted account before sending
- Track bounces and unconfirm user emails if needed
- (bonus) easy means to 'opt-out' from future emails on the same topic
- (bonus) easy means to 'opt-out' of all mass emails sent in a similar way
In this very specific case I know how to gather a list of all Toolforge members from OpenStack Keystone as either usernames or email addresses. Then I need to remove a set of users/email addresses who have explicitly opted-out of past survey announcements. The email will have a link to a survey form that in this case is not customized per-recipient, but I don't want that link posted on a wiki or a mailing list because that pollutes the survey pool. The trivial way to do the opt-out list would be to have people add their account names to a list on a specific wiki page. It could also be done with a magic category like MassMessage does. The big difference from Newsletter is that the list I want is opt-out rather than opt-in.
I think I can make all of this myself by creating a maintenance script that takes as input:
- wiki page containing a list of users to contact
- wiki page (or category?) containing a list of opt-ed out users for this message type
- wiki page (or category?) containing a list of globally opt-ed out users for this maintenance script
- file containing message to send
Mass message already handles all of these things I think. The difference is that it delivers the message as a talk page post rather than an email. On irc yesterday @Legoktm thought that making the email ability available as a MassMessage maintance script could be reasonable:
[04:07:19] <bd808> legoktm: is my idea at https://phabricator.wikimedia.org/T148783#3652887 to make it optional for MassMessage to send emails instead of talk page pings crazy? [04:07:39] <bd808> I don't want to start on code if it is :) [04:11:20] * legoktm looks [04:11:32] <legoktm> it's not too crazy [04:12:10] <legoktm> but I don't think it should be possible to send random emails via a web UI, it should be started via CLI script [04:12:24] <legoktm> but you can still use a mass message input list for it [04:13:06] <legoktm> so I think a maint script that gets a list of users from a MM input list and sends them emails would be acceptable
I've stared at the code of Newsletter and MassMessage for a while now. I think that I could probably find a way to twist either one into doing most of what I want for the Toolforge survey emails, but it doesn't seem to be a really great fit for either extension. I think that the "easiest" thing is going to be to write a custom maintenance script that does what I need it to do today and put that somewhere where others can find it and iterate on the functionality for other uses.
Here's what I'm planning on supporting:
- --subject STRING: email subject
- --body FILE: email body
- --to FILE: file of usernames to deliver message to
- --optout TITLE: wikipage containing list of users to exclude from contact
The maintenance script will send emails using User::sendMail. Bounce tracking will be automatically taken care of by BounceHandler if installed for the wiki.
The only criteria from the list this does not cover is (bonus) easy means to 'opt-out' of all mass emails sent in a similar way.
Correct. The content delivered via the Extension:Newsletter is purely a link to a local wikipage, it cannot be an external or interwiki link. E.g. screenshot and the link in there is to a page on mw.o. If we try to use an external link, we get an error message.
What I really want is:
It sounds like MassMessageEmail will indeed be the most feasible current solution.
There are 3 methods of creating MassMessage delivery lists, and the first is the easiest for someone to "opt-out of". You change the contentmodel of the wikipage to MassMessageListContent and it gives all entries a one-click (remove) link -- see example at https://en.wikipedia.org/wiki/Wikipedia:Wikipedia_Signpost/Subscribe#Add_pages (ignore the massive description above)