Mailgun is email for developers. Mailgun has elegant REST API to send and receive emails from your mobile app. I know that many Appery.io developers send emails from their apps for registration, confirmation, and everything else. To make it simple to use the Mailgun API in an Appery.io, we have introduced a Mailgun plugin in Appery.io.
The plugin has a sample app with one page that shows how to send an email using the API. You can use the sample app as a starting point or add the plugin to any existing app. Let me show you how to configure and use the plugin.
Installing the plugin
The first step is to add a plugin to a new or existing app.
Inside the App Builder (you can use an existing app or create a new one), select Create new > From Plugin
Note: the plugin currently available for jQuery Mobile app type. Coming soon for AngularJS app type
Find Mailgun Mail API under Communication category. Check the plug check box and click Import selected plugins button
On the next page, check the check box to open the setting file. Also set the start page to mailgun. Then click Apply settings button. The plugin will be added to your app.
Configuring the plugin
Now that the plugin is available in the app, there is minimal configuration that you need to do. There are three parts in this section.
Setting up Mailgun domain
Securing Mailgun API credentials
Setting up a secure proxy
Setting up Mailgun domain
The Mailgun domain identifies your account.
If you donβt have a Mailgun account, please Sign up for a free developer account.
Open your domain settings and copy the domain value β thatβs everything before .mailgun.org:
Paste the value for domain property in Services/Mailgun_settings file.
Securing the API credentials
Mailgun API uses Basic Authentication for authentication. You want to make sure the authentication information is not exposed on the client so you are going to keep secure on the server.
Inside the App Builder, click Database (tool bar, upper right)
Click Create new database. Call the database mailgunDB
Click Create new collection. Call the collection secret
Inside the secret collection, create two column by pressing +Col link. Both columns will contain strings
keyName (string type)
keyValue (string type)
Click +Row to add data to the collection
In the keyName column enter mailgunAuthProxy
As Mailgun uses Basic Authentication, you need to encode the username and password. The simplest way to do this is to open Chrome Dev. Tools Console tab and enter the following and press Enter (you will find the API key in the domain dashboard: >window.btoa(βapi:key-0ce1xxxxxxβ);
The encoded value will be shown on the next line: <βYXBpOmtleS0wYxxxx==β
Copy the entire value (including the == at the end). Go back to the database collection, for mailgunAuthProxy value enter βBasic β and then paste the entire value
Itβs is also very quickly to test the app on the actual device. You donβt even need to install the app. Simply install the Appery.io Tester app on your iOS or Android device and quickly launch the app.
Share the app
Itβs also fast to share the same app with you customers, clients, colleagues or friends. All they need to do is to install the Appery.io Tester app. Give them a special share code and they will be able to run your app.
Try this yourself
Liked this? Start developing with Appery.io free plan.
This site uses Akismet to reduce spam. Learn how your comment data is processed.