Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview

Buy Now

Issue 16.3 ('XDC 2018')
Instant purchase and download via GumRoad!


Mailgun with Xojo

Sending transactional email with Xojo

Issue: 16.3 (May/June 2018)
Author: Scott Boss
Author Bio: Scott Boss is the founder of Nocturnal Coding Monkeys, Llc, who specialize in writing custom software. Scott has been a developer, system administrator, storage engineer, consultant, and architect to businesses from startup to global 100.
Article Description: No description available.
Article Length (in bytes): 6,524
Starting Page Number: 84
Article Number: 16309
Related Web Link(s):


Excerpt of article text...

This month we are going to discuss an ongoing issue I have: transactional emails via API. Mostly, my clients want to send email like password reset or receipts for purchases. These are perfect examples of a one-time email that is template-based.

Until recently, I have been using Mandrill email API to send the emails. In March of 2016, MailChimp decided to change their pricing model. Instead of being able to send only transactional emails, you also had to have a paid mail campaign (MailChimp) account. Well, myself and my clients didn't need to do mail campaigns, so this ended up being money we were spending that we didn't get a benefit from.

In October 2016, Phillip Zedalis of 1701 Software wrote and released MailgunX (https://github.com/1701software/MailgunX). It is a Xojo class to send transactional emails using the Mailgun (http://mailgun.com) API.

I was pleasantly surprised to find how easy it was to setup a low volume account. As of the first of April, the lowest volume account was free. Mailgun makes it easy to go from one account level to another based on the volume of emails sent or features needed, including auto-upgrading your account to the next level if that will lower your overall cost (for example, too many sent emails over your allotment).

Once you follow the steps to sign up with Mailgun, you can get your API keys so you can send email (see Figure 1). As part of the steps, you have to update your DNS records to add some TXT and MX records. This is why they suggest using a subdomain for Mailgun. For adding my domain to Mailgun, I had to add two TXT records and two MX records. If you are going to use Mailgun for more than a transactional mail service, you might have to add more DNS records or take extra steps. As you can see in Figure 1, this lists out my API keys.

Phillip has supplied a nice sample program with MailgunX (see Figure 2). The top two fields in Figure 2 are the API key information. This has to be set to utilize the API. After that, you fill in the from, to, and message fields and it sends email(s).

...End of Excerpt. Please purchase the magazine to read the full article.