Using Mailgun for bulk email

Why do I need a service like Mailgun?

Email applications like Microsoft Outlook, Apple Mail, and Close make drafting, sending, and receiving email easy.

Regardless of what app or service you're using, all of the sending and receiving actions happen on your email server - and every email server has a limit on how many messages it will allow you to send each day.

Depending on the maximum outbound email limit of your email server, if that threshold is reached, your email server will stop sending all emails from your email account - from Close or otherwise. Bulk email tools like Mailgun enable you to send large quantities of emails without the risk of your email server halting your outbound emails that day if you exceed the email server's daily quota limit.

Read this first:

Mailgun is one of many powerful 3rd party email services that work well with Close, yet the team here at Close doesn’t maintain it. We’ll always do our best to help out, but the email functionality Mailgun offers happens outside the Close application, and likewise outside our control and visibility. If you need additional help with Mailgun, you'll probably need to contact Mailgun.

Curious why you might want to use Mailgun or a similar service? See our Bulk Email FAQ.

We also wanted to kindly warn that the steps below require experience administrating Domains and DNS records. Incorrectly modifying DNS entries could prevent your organization from sending and receiving all email, take your website offline, and possibly halt other services from running properly as well. These steps are best performed by your IT provider or support team.

You'll need your domain host credentials

You’ll need your administrative username and password to log into your domain host (“domain registrar”) to make DNS changes. Your domain host is typically the company from which you purchased your domain name. Companies like GoDaddy, NameCheap, Network Solutions, Rackspace Email & Apps, Digital Ocean, Google Domains, and others are common domain hosts and registrars.

Not sure who hosts your domain? You can often find out by searching for your domain here and viewing the “registrar” field: https://whois.icann.org/en/lookup

Getting started

Create your Mailgun account

  1. Create an account with Mailgun. If you plan to send more than 10,000 emails a month, you’ll need to purchase a paid plan.
  2. Activate your Mailgun account: Open the Mailgun activation email you received in email account you used for signup and follow the instructions provided.

Adding your email domain name to Mailgun

  1. In Mailgun, go to Messages > Domains > click the Add New Domain button – or click here.
In Mailgun, go to Messages > Domains > click the Add New Domain button

In Mailgun, go to Messages > Domains > click the Add New Domain button

  1. Add your domain name. If your email is bob@mycompany.com, then your domain name is everything after the "@" symbol: mycompany.com
  2. We recommend checking the box “Create DKIM Authority” and selecting the option for 2048 DKIM Key bit-size for increased security.
Add your domain name, select your nearest region, and select the appropriate DKIM key bit-size.

Add your domain name, select your nearest region, and select the appropriate DKIM key bit-size.

  1. On the following page, save the list of DNS records using the Print/Save button toward the top right. Keep this tab open for easy copy-paste. Example:
Example DNS entries to add.

Example DNS entries to add.

Adding the DNS entries

  1. Log into your domain registrar/host and navigate to the DNS settings

Pro Tip: Follow the links to see guidance on adding new DNS records

Revisit the You'll Need Your Domain Host Credentials section above and click on the various domain hosts listed for examples of modifying DNS entries.

  1. Create the TXT record for SPF: If you don’t already have a TXT record with a SPF value listed, you can use what Mailgun provided. If you already have a TXT record with an SPF value, you’ll need to modify it to match this format: v=spf1 include:mailgun.org ~all include:YOURDOMAINEMAIL.com ~all - replacing the all-CAPs portion to represent your domain name.
  2. Create the “domainkey” DKIM TXT record Mailgun listed
  3. If you already have MX records listed, do not add the Mailgun-provided MX records.
  4. Add the CNAME record Mailgun provided.
  5. Save your DNS changes.
  6. Back in Mailgun, click the Verify DNS Settings button: Note that DNS changes can take 24-48 hours to propagate globally.

Configuring Close to work with Mailgun's SMTP

  1. Once your DNS settings are verified (usually 24-48 hours later), log into your Mailgun account in your web browser
  2. Go to Domains > Click your domain name > Click Settings > SMTP Credentials
  3. Here, you'll see your current SMTP login details - keep this info handy for the following steps!
Example SMTP information

Example SMTP information

  1. Open the Close app and navigate to Settings > Communication > Email > Edit SMTP
Click "Edit SMTP"

Click "Edit SMTP"

  1. Click the radio button for Other to manually specify your SMTP server details.
  2. Enter your SMTP details you noted in step #3 above and then click Save Settings
Enter your Mailgun SMTP settings and click "Save Settings"

Enter your Mailgun SMTP settings and click "Save Settings"

Adding Unsubscribe Links

Most Countries have specific laws that specify how you may utilize bulk email. You're responsible to abide within the applicable regulations, but an honorable (and recommend!) first step is to enable the option to unsubscribe from future emails. This will also help with keeping your email domain off of globally-monitored black lists.

You can add %unsubscribe_url% to the bottom of any email templates you'd like to bulk message and Mailgun will rewrite the message to include an unsubscribe link and manage the process of not sending emails to people who have opted-out. More details here: https://documentation.mailgun.com/user_manual.html#tracking-unsubscribes

Using Mailgun for bulk email


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.