Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
Merge pull request #2661 from mozilla/bulk-mailer-fix, r=@philbooth, @…
Browse files Browse the repository at this point in the history
…vbudhram

fix(mailer): Fix the bulk-mailer, add lots of tests.
  • Loading branch information
vbudhram committed Oct 17, 2018
2 parents 3047fa9 + 806129d commit c009a56
Show file tree
Hide file tree
Showing 35 changed files with 3,053 additions and 1,882 deletions.
27 changes: 27 additions & 0 deletions docs/bulk-mail.md
@@ -0,0 +1,27 @@
# Sending emails manually

Sometimes it's necessary to send emails manually. Doing
so requires access to a production auth-server machine and
the user database.

## Steps

1. Know which users you want to send emails to.
2. Use the [dump-users.js](https://github.com/mozilla/fxa-auth-server/blob/master/scripts/dump-users.js) script to
write the necessary user information to disk. Users can be dumped by `uid` or `email`
* uid, listing uids on the command line
> node ./scripts/dump-users.js -u 62f8f86fb6ce42b39431547fda1fb87d,567f8f86fb6ce42b39431547fda1fb8124 > ./user-list.json
* uids, listing uids in an input file
> node ./scripts/dump-users.js -u --input uids-to-dump.txt > ./user-list.json
* email, listing emails on the command line
> node ./scripts/dump-users.js -e testuser@testuser.com,another@another.com > ./user-list.json
* email, listing emails in an input file
> node ./scripts/dump-users.js -e --input emails-to-dump.txt > ./user-list.json
3. Test sending the emails
* write to the console
> node ./scripts/bulk-mailer.js --input ./user-list.json --method sendVerifyCode
* write to disk
> node ./scripts/bulk-mailer.js --input ./user-list.json --method sendVerifyCode --write ./email_output/
4. Send the emails
> node ./scripts/bulk-mailer.js --input ./user-list.json --method sendVerifyCode --send
4 changes: 4 additions & 0 deletions lib/db.js
Expand Up @@ -421,6 +421,10 @@ module.exports = (
)
}

/**
* This route intended for internal use only. Please use `accountRecord`
* for all other uses.
*/
SAFE_URLS.emailRecord = new SafeUrl('/emailRecord/:email', 'db.emailRecord')
DB.prototype.emailRecord = function (email) {
log.trace({ op: 'DB.emailRecord', email })
Expand Down

0 comments on commit c009a56

Please sign in to comment.