7
30 Comments

Automated email sending for $0

Here’s how I did it.

1. Decided not to do it the easy way

Yes, there are excellent email sending services out there. I decided against going with a Mailchimpish solution for The Quit Work Project because I didn’t want to pay anything (this is a personal project from which I don’t anticipate any revenue) and I didn’t want any third-party marketing at the bottom of my emails.

2. Chose a free email sending service

I use Mailgun https://www.mailgun.com/ which offers 10,000 emails a month for free. It’s extremely easy for software developers to integrate into a web site.

3. Implemented automated subscribe, confirm and unsubscribe

Subscribe’s the hard part, because there are bots that tirelessly fill any form they can find on the web. I hate captchas (if I’m asked to select all the squares with buses or bikes one more time I’m liable to throw my laptop out of the window), so I used a few other tricks to thwart the bots:

• create the subscribe fields and buttons in Javascript rather than have them hard-coded in HTML (I bet there are few bots that bother running Javascript);
• create fields that are visible to bots but invisible to humans (if there’s text in those fields, it’s probably spam);
• measure the time between page load and submit (if it’s less than seven seconds, it’s probably spam).

When someone (human) subscribes, I send an email through the Mailgun API asking them to confirm their email address by clicking a link with a code that identifies them. No confirmation, no subscribe.

4. Implemented automated daily email sends

All my content is in a database, so that it can be formatted for web, email, Twitter, Instagram, etc. I have a script that’ll send a test email to myself through the Mailgun API, so that I can check whether the content is correct, then send an email to everyone who has subscribed and confirmed but hasn’t unsubscribed. I do this every day to send daily reasons to quit work to subscribers to the The Quit Work Project.

I hate unsubscribe links that require you to do further work to unsubscribe (e.g. after you’ve clicked the link, you have to enter your email address, select which lists you want to unsubscribe from, etc.) So I include an unsubscribe link in each email with a code that identifies the subscriber, so that you’re unsubscribed from all emails in just one click.

That’s one of the great things about a service like Mailgun: software developers can very easily customize emails for individual subscribers.

Any questions about what I did? Have you automated email sending in some other way? I’d love to hear from you.

  1. 3

    Amazing. I love this as well and have made some really good experiences with Mailjet (they got acquired by Mailgun late last year).

    1. 1

      Mailjet requires a company email to be used while signing up.
      when I try to signup using my personal email it warns "Sign up with a work email to avoid sending limitations." being an indie developer, its not possible to signup through a company account.. is there any workaround of this you know of?

      1. 1

        My routine is somewhat like this:

        • Register domain
        • Get domain email set up with Yandex.com (just like G Suite, but still free!)
        • Register with my company email address with Mailjet (and other services)
    2. 1

      Sounds like Mailgun have been on an acquistion spree!

  2. 2

    As an update on this thread- it looks like Mailgun has changed their plans and are no longer offering 10k emails and 100 validations per month. You get 5k per month on their flex plan and then pay as you go.

    https://www.mailgun.com/pricing/

    1. 1

      Yeah, it really sucks when your provider switches up the deal on you, especially after you’ve given them so much free publicity! I’m not even sure from their pricing page that they include 5,000 emails a month... they just mention a mysterious “trial volume”. Nothing worse than pricing where you can’t work out what the price is. Not cool.

  3. 2

    I also use Mailgun inside a NodeJS server. It handles all the automated sending I currently need and should I need to switch providers at some point, all of my email needs are abstracted to a single location in the code.

    Initially chose Mailgun because of the free tier, but I haven't had any issues with any part of the service so far.

    1. 1

      Mailgun accepts Credit cards only, I would like to use paypal to setup mailgun payments, is there some way to link paypal with mailgun?

      1. 1

        Gotcha. I'm not sure there is. You could likely contact them on Twitter or through their site to check with them directly though.

  4. 2

    Have you ever considered Amazon SES??
    I have been using it for a while, and I'm very happy, also with their pricing and sending limits.

    1. 1

      Ah, interesting, I didn't know Amazon were doing this, thanks for letting me know.

      I confess the very mention of Amazon sends shivers down my spine, with memories of trying to spin up EC2 instances through their horribly opaque interface! I know the word "Simple" is in the name "Amazon SES", but I confess, I'm skeptical. How have you found the ease of getting going with them?

      For me, since I'm not using AWS for this project, Amazon SES isn't free, whereas Mailgun is. Free is hard to beat!

      1. 1

        True, free is better than cheap!

        Compared to the other services, it is very simple to set up. I would even go as far as saying it is intuitive. You can use it via SMTP or API.

        I still have to give mailgun a try. I've seen many projects using it, but never found the time

  5. 2

    I'm doing similar things in Mailgun.

    My app is built in Laravel, so I do automated emails through the built-in queuing system (similar to Sidekick in Rails). When someone takes an action that triggers an email sequence, I go ahead and queue every message in that sequence. When that message comes out of the queue, I first make sure that the conditions are still valid (i.e. have they done anything since then that would reset the sequence or unsubscribe) and then send the automated message.

    I've also built out my own newsletter service that lets me send large bursts or drip out a campaign over a few days to ramp up my volume. I found that after ~10k emails in one burst I would start to get blacklisted, so now I do an initial burst of 2-3k with a few subject lines and then slowly ramp from around 20/hour (480/day) to 200/hour (4800/day) until my monthly newsletter is sent.

    1. 1

      Very cool. I like how you queue all the sends in advance!

  6. 2

    This is great stuff. I have a postmark account (super impressed with them) and need to really utilize it better. Have toyed with triggering emails through zapier from trello cards being moved. Your guidance is good motivation for a proper revisit.

    1. 1

      Wow, that would be a cool project. Good luck!

  7. 2

    For the subscribe process do you just have a form to fill out and it makes an API call to mailgun?

    Do you then temporarily store the users data until they validate via an email address? And delete that temporary data after a set amount of time?

    1. 1

      Yes, I create HTML inputs for the subscriber's email address and any other information I'm asking for, then call a PHP script when they click the subscribe button.

      This PHP script adds the information to the database (email address, subscribe time, etc.) and calls the Mailgun API to send the confirmation email, with a confirm link with a custom code that identifies the subscriber (without exposing their email address).

      Clicking the confirm link takes the subscriber to a "Thanks for confirming..." web page that executes another PHP script to set the confirm time in the database.

      My daily script sends emails only to subscribers who have subscribed and confirmed and haven't unsubscribed.

      I don't currently delete data after a set amount of time, because those unconfirmed or unsubscribed email addresses aren't doing any harm in my database, but I could certainly clear them out with a simple SQL command.

      That way, I have a full record of people's subscribe, confirm and unsubscribe times, which is good for compliance with GDPR and similar consumer privacy regulations. If anyone requested that I delete all their data, I would, of course, simply remove their record from the database.

      Hope that helps!

  8. 2

    That’s one of the great things about a service like Mailgun: software developers can very easily customize emails for individual subscribers.

    This is very interesting indeed. I want to implement customised emails for Resolut users too in the near future (to remind each user of their resolutions periodically). This looks like a good solution for that. Have you done it? How easy is it to integrate with a web app?

    1. 4

      I haven't used Mailgun, but for what it's worth Sendgrid provides something very similar.
      You can programmatically trigger an email to be sent from your app using their API, and the content of this email is entirely crafted by you, so you could drop in variables, or even change the content entirely depending on whatever parameters are important for you.

      1. 2

        Nice! I have only used mailchimp so far and didn't need to personalize emails. So I am not aware of these tools. I will definitely play with Sendgrid too.
        Thanks a lot!

        1. 2

          Mailchimp suspended my account very early on after I sent test emails to my own address, apparently that counted as spam for them! Months of follow up with their legal team did nothing (yet I still receive updates of people signing up here and there, how insulting)

          I don't know if it has been a curse or a blessing, but I'm glad it made me look at other solutions.

          Good luck!

          1. 2

            That sounds painful! I tend to go with new, hungry providers like Mailgun these days, rather than old, established providers like Mailchimp. The bigger players seem to care less about losing customers like you along the way.

            1. 2

              Indeed it is! I learned my lesson :D

    2. 3

      It should be super easy to integrate maligun to your app; I use their Node.js SDK and it's just a matter of setting up your API Key and then call their create method. (Source: https://github.com/mailgun/mailgun-js)

      1. 2

        Sounds easy indeed. Will explore this solution definitely! Thanks!

    3. 2

      Yes, as @omneity says, it's easy to send a fully customized email through Mailgun, SendGrid or others (I've had good experience with SendGrid, too).

      It's a simple cURL request: set up your email addresses, pass into the API the email address you want to send from, the email address you want to send to, the HTML content of the email and the text content of the email (in the unlikely event that someone has set up their email client to show unformatted emails), and it's done!

      It's best to send emails from subdomains (e.g. I send from [email protected], [email protected], etc.), since each subdomain has its own spam rating. If you make sure you never send an email that someone will mark as spam (the prominent unsubscribe link really helps with this!) then you should be OK, but just in case, you can always start sending from a new subdomain if your old one gets an undeserved reputation for being spammy.

      1. 1

        Wonderful.

        Thanks so much for being so helpful and giving me those tips!

        I am always blown away by the amount of support I find in this community.

  9. 1

    Mailgun accepts Credit cards only, I would like to use paypal to setup mailgun payments, is there some way to link paypal with mailgun?

    1. 2

      Sorry, I don't know of any way around this!

  10. 1

    This comment was deleted 4 years ago.

Trending on Indie Hackers
How I grew a side project to 100k Unique Visitors in 7 days with 0 audience 47 comments Competing with Product Hunt: a month later 33 comments Why do you hate marketing? 27 comments $15k revenues in <4 months as a solopreneur 14 comments Use Your Product 13 comments How I Launched FrontendEase 13 comments