This post will demonstrate a fast and easy way to get started with the Mailgun API in Android, using the Volley HTTP library.

  1. Implement the Singleton

This is well explained in the Android docs:

Android docs on using Volley with a Singleton

2. Creating & sending the request to Mailgun

In my use case, I have an app with a ‘Request Feature’ button that takes input from the the user: an email address and a message.

Image for post
Image for post
Feature Request UI

The POST request consists of header (authentication info), params (message data) and the URL (message post URL).

Sub out the Constants for your private Mailgun API key, mail domain name and recipient email. The available params can be found in the Mailgun docs.

Check the Logs in Mailgun for details of the request. If successful, email should be received to the recipient’s email:

Owen Roberts

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store