Send Your First Transactional Email

At a glance

Sending email is what Mailchimp Transactional is all about. But before you can start sending, there are a few things to set up. In this guide, we’ll configure your DNS records, verify that you own the domain you want to send from, and walk through sending your first transactional email to verify that everything is working correctly.

What you’ll need

  • A Transactional Email account

  • A domain you’d like to send from

  • Access to the DNS records for that domain

  • Your API key

Transactional vs Marketing Email

Before configuring your servers to send email with the Transactional API, let’s distinguish when you’ll want to use that — and when you want to use the Marketing API instead.

If you’re sending bulk email, you should always opt for the Marketing API. The Marketing API won’t just help you send those bulk emails — it also helps you create and refine the audiences that you’re planning to send those emails to. 

You can use the Marketing API for:

  • Marketing emails about an upcoming sale

  • A weekly newsletter

  • An email about an upcoming event

You should choose the Transactional API when you want to send an email to an individual, usually in response to some event happening in your application. 

You can use the Transactional API for:

  • Password reset emails

  • Purchase confirmation emails

  • Shipping notifications

  • Forum activity

Note: You may at times be able to use the Marketing API where you might traditionally reach for transactional email. For more, see Track Outside Activity with the Events Endpoint.

Add a sending domain

First, you’ll need to add the domain you’d like to send your emails from. For this guide, let’s say we want to send email from info@example.com. That means our sending domain is example.com.

  1. Navigate to the Sending domains page in your Mailchimp Transactional Email account. 

  2. Enter your domain name in the domain input (e.g., example.com) and click Add.

Configure your DNS

Once you’ve added your sending domain, you’ll need to create DNS records to enable DKIM and SPF email authentication for that domain.

First, let’s set up DKIM: Next to your domain, click View DKIM settings. A modal will appear with instructions to set up DKIM on your DNS provider. You’ll need to set up a new TXT record with your DNS provider for your domain with the provided values. The domain name will look something like mandrill._domainkey.example.com, and the value will contain a long string that you’ll want to copy and paste.

Note: Adding TXT records varies by DNS provider, so if you don’t know how to do this with your provider, search their documentation or contact their support.

To enable SPF, you’ll add another TXT record, this time for the bare domain you added as your sending domain. Click View SPF settings; the modal will again prompt you to create a new TXT record with a domain name and value. In our example, the domain is example.com and the value is v=spf1 include:spf.mandrillapp.com ?all.

Once you’ve set up the TXT records for both DKIM and SPF, you can verify that you configured everything correctly by clicking the Test DNS Settings button. Both your DKIM and SPF settings should now indicate that they’re valid.

DNS records can take time to propagate, so if these records are still shown as missing and you’re confident that you set up your TXT records correctly, you may have to wait for your DNS provider to propagate those changes.

Verify domain ownership

Finally, you’ll need to verify that you can receive email at the outbound email domain you just set up. We won’t go into every possible way you can set up inbound email on your server, but if you don’t already have inbound email set up, see “Set Up Inbound Email Processing.”

Verifying your email is as simple as entering a valid email address where you can receive email, then clicking a verification link Mailchimp sends to that address.

To send that email, click the View details link below the Requires verification warning; enter a valid email address and click Send Verification Email.

In the email, you’ll receive a verification link that looks like this:

http://mandrillapp.com/settings/verify-domain?domain=example.com&key=VERIFICATION_KEY

Click the link, and your domain should now be verified.

Send your first email

With everything set up, we can start sending email from your sending domain. 

The simplest email you might send looks something like this:

Send your first email

MESSAGE='{"key": "$YOUR_API_KEY", "message": {"from_email": "hello@example.com", "subject": "Hello World", "text": "Welcome to Mailchimp Transactional!", "to": [{ "email": "freddie@example.com", "type": "to" }]}}'

curl -sS -X POST "https://mandrillapp.com/api/1.0/messages/send" --header 'Content-Type: application/json' --data-raw "$MESSAGE"

If you receive this email, that means everything is up and running — and you’re good to start sending transactional emails! 

Note: Now might also be a good time to view your outbound activity in the application and familiarize yourself with some of the ways the Mailchimp Transactional Email web application gives you visibility into your sent email.