Back to main menu

Case Studies

How Launch School Academy increased student engagement 3x

This post is written by Kevin Wang, Chief Instructor at Tealeaf Academy (Launch School). Tealeaf Academy is an online school for developers, and offers intensive, project based online bootcamps on web development. If you think this post is useful, you should check them out!

Company size




Use case


Key metrics



At Tealeaf Academy, creating a “Study Together, Progress Together” experience for our students is at core of our way of teaching. One of our core tools is the discussion board where students ask questions, share ideas, collaborate on homework assignments, and teachers quickly jump in to help students get unstuck on problems. One of our recent priorities was to reduce friction in discussion board usage and encourage more discussions with a complementary email notification and a “reply-to email to post on discussion board” workflow.

Once we implemented the below code using the Mailgun Routes API, activity on our discussion board increased three fold, and questions are now typically getting answered within an hour, sometimes even minutes, and students are able to move on the next set of tasks a lot quicker. Here’s how we did it:

Our workflow would go as the following:

  1. When a post (most likely, a question) is created, all course participants are notified by email notification

  2. Course participants can reply to the email notifications directly from their email inbox, without having to sign into the course

  3. That reply will be posted on the online discussion board, and are also sent to other course participants, to keep the conversation going.

Why we choose Mailgun

The key piece of this workflow is to receive and parse inbound email messages. We looked around for several email service providers, and in the end picked Mailgun because:

  1. It is very developer friendly – We are developers, and Mailgun speaks to us. The APIs expose a lot of low level options that allows tweaking. We like the routes in particular – It’s a nice layer of abstraction that makes integration with apps very easy. (see how we use it below)

  2. It is the most feature complete service we have found – we can use Mailgun for transactional emails, campaigns as well as email lists – it’s nice to have just one service provider to handle everything we need.

  3. The price is reasonable and the upgrading path to dedicated IP and custom DKIM is nice, even we do not need it yet.

  4. The support is top notch. There is a live chat that I can talk to their developers directly on issues and it has been very useful for us to get issues resolved.

Setting up the email infrastructure

  • The first step was to create a new domain on Mailgun. In our case, it’s which we use for sending and receiving emails.

  • Next, we created a MailgunGateway as our wrapper for Mailgun’s API. This wrapper takes care of all our interactions with Mailgun through our account. Here we use Mailgun’s send_batch_messages API to send HTML emails. It allows us to send a message to multiple receivers with a single API call. We keep our API key as environment variables on the server for extra security. There is also a simple delivery filter such that no emails are sent in the development environment; On staging, all emails are sent to Chris (my co-founder) and myself, so we can test out things without fearing to spam our users; Only on the production environment emails are sent to real users.

Send email notifications for new post or comment

Once a post or comment is created, we send an email notification to all course participants. We are sending emails synchronously for now, but as we have more users, we’ll probably want to offload this to a background job.

The CourseNotifier is the class where we put our application specific logic on notifications. Note that MailgunGateway is injected in as the default gateway – this is from when we used to have multiple email service providers for campaigning, lists and transactional emails. It is less of a need now that we consolidated all email delivery needs to Mailgun!

The replytoaddress is where we insert the post token into the “Reply-To” header. The content of the emails are quite simple so we just put them here in the class. If we had a more elaborate email style, we would have used template rendering to handle it. With Mailgun’s sendbatchmessage API, we can call the API just once to send to multiple recipients, and the recipient_variables method is where we customize email messages for each receiver to include their names to add a personal touch.

Handling inbounding messages in the application

Heading over to Mailgun, under “Routes” in the Control Panel, we created a route as the following:

  • Filter Expression: match_recipient(“reply+(.*)”)

  • Action: forward(“”)

When a user replies to an email, they reply it to an email address such as “”, and this route will forward the email to a web hook that we expose to handle incoming messages.

Here, we use the sender’s email to find the author, and use the post token to find the post that this reply should be collated under. Mailgun gives us the very useful stripped text which strips away the original message part to only contain the actual reply! In the end, we return a 200 header to tell Mailgun that this interaction is successful, otherwise Mailgun will think our server is down and will faithfully keep trying to call our webhook.

The result from implementing this workflow is impressive – activity on our discussion board increased three fold, and questions are now typically getting answered within an hour, sometimes even minutes, students are able to move on the next set of tasks a lot quicker and we are very happy how this turned out.

“We’re able to ensure a better service for our marketers by using Mailgun. They count on us, and we count on Mailgun: and this relationship helps us maintain credibility with our customers.”

Paulius Milisauskas

Paulius Milisauskas

VP of Customer Operations

Related resources

Zipbooks case study article photo

Zipbooks switched from Mandrill to Mailgun using Laravel

ZipBooks, a happy customer of Mailgun, is free accounting and invoicing software with every feature you might expect from a paid application...

Read more

Switchboard logo

How Switchboard improved email deliverability with Mailgun Validate

In the world of elections, reputation is everything. For Switchboard, it’s about helping candidates reach voters and supporters to win elections. Because every vote counts...

Read more

Email's Not Dead banner

S4 Ep. 03: Email data and oops pancakes with LB Blair of Platonic Ideal

In our latest episode, we’re talking to LB Blair, the founder of Platonic Ideal. LB has been in the industry for years, and she combines her love of data and her passion for email together in her work. LB has some hot takes on why data needs to be utilized in your...

Read more

Email icon

Keep me posted! Get the latest from Mailgun delivered to your inbox.

Send me the newsletter. I expressly agree to receive the newsletter and know that I can easily unsubscribe at any time.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

See what you can accomplish with the world's best email delivery platform. It's easy to get started.Let's get sending
CTA icon