How to create a newsletter within Meteor?


I want to create a newsletter on my Meteor app. When a new user signs up, they are automatically enrolled. The newsletter emails can be scheduled. The user can unsubscribe from the newsletter using a link in the bottom of the email. They can re-subscribe using some arbitrary button in the UI of the app.

This seems like a common use case but I can’t find much online. Any suggestions on how to construct this with Meteor?


Usually you would use an external mailing service to handle the details of the mailing list and such, like MailChimp or Mailgun. There are plenty of api packages for these on NPM.

If you want to deal with the list yourself, it should be pretty straightforward, like you would build anything else in meteor. You could save a “newsletter: true/false” within the emails array for the user, included in the accounts package. For unsubscriptions you could add a simple html route for /unsubscribe/, with the link included in the initial email.


Thanks for your reply! I’d like to use Mail Chimp, but I guess my question is how do I keep the mail chimp mailing list constantly in sync with Meteor?


Within a Accounts.onCreateUser you can call subscribe with the email address provided using the mailchimp api.
Within a static route on the server, you can unsubscribe the user, or you can just include the unsub link provided by mailchimp.

You don’t need to sync anything really, as the list is only stored in one place, in mailchimp. You don’t need to store any data about the mailing list in meteor.


Hmm, okay. But what about the scenario where the user changes their email address from the UI. My app allows for that. Mailchimp will still be sending to the old address and not the new address. I guess I need some extra logic in the edit address mutation to push the new address to Mailchimp and pull the old one?


Sure. Just call unsubscribe to mailchimp with the old address, and subscribe with the new one. I bet there is an edit address call in the api as well, but can’t promise.


yes you can : (at end of page)


You might also need a well constructed / tested HTML email template. Have a look at: