Notifications in web apps: Mailgun and Twilio

Home » Blog » Software » Web Applications » Notifications in web apps: Mailgun and Twilio

If you want your web app to notify your users upon specific actions or events Mailgun and Twilio are great solutions for doing so.

The former allows you to – among various other features involving eMail – send eMails via a nice and simple REST API. This is particularly handy because you don’t have to worry anymore about delivering eMail asynchronously in order not to delay user actions in the browser. For example, with Mailgun you can simply commit a registration confirmation eMail to their REST API once a user registers without delaying the browser response shown to the user.

Twilio in turn, lets you – again amongst various other telephony-related features – send text messages via SMS, which is great for informing users about urgent events.

There’s lots to be told about both services and how to use them but I found this Mailgun-related tip to especially useful:

How to send a String as an attachment with the Mailgun API and RestClient

Monkey-patching Ruby’s StringIO class this way allows you to generate eMail attachments on the fly with no need to save them as temporary files that clutter your file system (which you – depending on your environment – might not even be allowed to do, Heroku restricts access to the actual file system, for instance).

Leave a Comment

* Checkbox GDPR is required


I agree

By continuing to browse the site you agree to our use of cookies. Privacy Policy

Privacy Preference Center

Strictly necessary

These cookies are necessary for the site to function.

PHPSESSID: Preserves user session state across page requests.

__cfduid: Used by the content network, Cloudflare, to identify trusted web traffic.



Remembers the user's submitted data when a comment is submitted in a blog post. The purpose is to aut o-populate form fields for subsequent comments, in order to save time for the user.



Statistic cookies help us to understand how visitors interact with our websites by collecting and reporting information anonymously.

_ga: Registers a unique ID that is used to generate statistical data on how the visitor uses the website.

_gat: Used by Google Analytics to throttle request rate.

_gid: Registers a unique ID that is used to generate statistical data on how the visitor uses the website.

collect: Used to send data to Google Analytics about the visitor's device and behaviour. Tracks the visitor across d evices and marketing channels.



We use Wordfence to secure our website against hacking attempts:


Close your account?

Your account will be closed and all data will be permanently deleted and cannot be recovered. Are you sure?