Email is still the most reliable way of messaging online. It is universal, it is not owned by anyone, it's got the most users out of any messaging system in the world, it's easy to use. This is why I prefer email newsletters. This is why I subscribe by email and why I let my visitors have this option.

Mailgun is still my favorite emailing service. No, I haven't tried them all. I haven't tried any. I have no reason to.

Here is how you can also get returning visitors with email subscriptions.


I'm skipping the "how to set up Mailgun" tutorial, as I've written about this here.

Everything set up? All you need to do now is create a mailing list. I'm sure you're smart enough but I'll add images of the three buttons you need to press anyway, makes this blog look more fun and attractive. from a distance.


I'm assuming you know how to deal with forms. If not - google it! Or ask me to write a tutorial. I'll do it if you promise me heavy traffic!


First things first, we need to send a post request so we need to add the http module first

meteor add http


So we have code in four files:

    secrets.js     // separate file for api-key
	mailgun.js     // sends data to Mailgun
	dostuff.js     // call mailgun.js when form is submitted
.gitignore         // keeps our secrets.js secret


Mailgun gives you an api-key, that you can access from We need to attach this to our "sign this guy up for the newsletter" message to authenticate our app, but we also need to keep it a secret from the nasty hackers. Actually, hackers are cool and they may just save the world someday. But anyway we'll try keep them from screwing with our mailing list.

process.env['MAILGUN_API_KEY'] = "key-keepingitasecretlikeapro";


This is what does the actualy work - sends data to Mailgun through a post request.

Meteor.startup(function () {
		subscribe: function(email) {

			// Make multiple requests faster

			// Define useful variables
			var mailinglist = ''
			var apiURL = '' + mailinglist + '/members' 
			var options = {
				auth:"api:" + process.env.MAILGUN_API_KEY,
				params: {
					subscribed: true,
					address: email,

			// What happens after the request has gotten reply
			var onResult = function(error, result) {
					console.log("Error: " + error)
				} else {
					console.log("Subscription successful")

			// Make the actual request happen, options, onResult)


Extracted the email from the form? Good. Now give it to the subscribe method on the server and let it do it's thing.'subscribe',


Ban git from knowing our harmless little secrets.


Magic sauce

Getting people to subscribe

People recognize good content and they do want to subscribe to your stuff. Sometimes you just need to remind them to do it. A great, fun article about human behaviour:

Oh, and don't forget to subscribe!