In T303240: Welcome emails: opt-in checkbox we created a checkbox for opting-in to the mailing list. In this task we want to generate CSV exports with the emails of user accounts who checked this box.
We'll want a maintenance script that has the following features:
- support querying by dates with --from and --to fields
- --output-mode, default is 'text' to print to stdout (one entry per line), otherwise --output-mode=csv would create a CSV for importing in Mailchimp
- allow outputting data on whether the user has a confirmed email or not
- allow outputting null value for email in case the user has checked the opt-in box but doesn't have a supplied email (for QA purposes, really)
- add the "Email Address" header per the mailchimp requirements https://mailchimp.com/help/import-contacts-mailchimp/#Import_new_contacts