Aliyun Mail & DirectMail: DKIM, SPF & DMARC Setup

Step-by-step Aliyun DirectMail sender domain verification: the six DNS records, the SPF include values, region-based DKIM selectors and DMARC publishing.
4 min read
Updated 2026-11-04
Brand Specific
aliyundirectmaildkimspfdmarc

Aliyun splits email into two products, and their DNS records differ. DirectMail is the transactional and marketing sending service, configured per sender domain in its console. Alibaba Mail, formerly Aliyun Enterprise Mail, is the hosted mailbox product with its own MX hosts and SPF include. Mixing the two record sets on one domain breaks both.

This guide follows the DirectMail sender domain flow, then notes exactly where Alibaba Mail differs. Examples use yourdomain.com.

What you need

  • An activated DirectMail service.
  • DNS management for the domain, either Alibaba Cloud DNS or a third-party provider.
  • A domain that is not already used by another email service. If it is, use a subdomain such as mail.yourdomain.com for sending.
  • Time: about 20 minutes after saving records, up to 48 hours for full propagation.

Step 1: add the sender domain

In the DirectMail console, open Sender Domains and click Add Domain. Enter the domain and confirm. Entering yourdomain.com registers a primary domain; mail.yourdomain.com registers a subdomain, whose host records are shorter because the prefix is already part of the name.

Find the domain and click Configure. That page is the only authoritative source for your values — Aliyun generates them per account, region and domain. Do not copy values from a blog post.

Step 2: publish the DNS records

A manual sender domain needs six records: domain ownership, SPF, DKIM, MX for the reply address, and the DMARC record Aliyun now expects before verification passes.

@                      TXT   v=spf1 include:spf1.dm.aliyun.com -all
aliyundm               TXT   e000a000b000c000d9
aliyun-cn-hangzhou._domainkey  TXT   v=DKIM1; k=rsa; p=MIIBIjANBg...
@                      MX    mx01.dm.aliyun.com
_dmarc                 TXT   v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com
_dmarc                 TXT   (the ownership record shown in the console)

Three details decide success:

  • The SPF include is spf1.dm.aliyun.com for DirectMail. Alibaba Mail uses spf.qiye.aliyun.com instead. If you send through both, merge them into one record: v=spf1 include:spf.qiye.aliyun.com include:spf1.dm.aliyun.com -all. Two separate v=spf1 records cause a permanent error.
  • The DKIM selector is region-specific. Records look like aliyun-cn-hangzhou._domainkey, aliyun-ap-southeast-1._domainkey and so on. Use the selector your console displays, and check it with nslookup -qt=txt aliyun-cn-hangzhou._domainkey.yourdomain.com.
  • For a subdomain, shorten the host. If the sender domain is mail.yourdomain.com, the ownership host becomes aliyundm.mail and the SPF host becomes mail, not the root.

Step 3: verify the domain

Return to Sender Domains and click Verify once DNS has propagated. For new domains, verification requires SPF, DKIM, DMARC and MX to all pass — a missing DMARC record blocks the domain even though mail would otherwise send. Earlier domains only re-check ownership, SPF and MX.

If verification fails, query each record directly before opening a ticket. Missing trailing dots on the MX value, a TXT value pasted with line breaks, or a DKIM key that your DNS provider split at 255 characters are the usual culprits.

Step 4: publish DMARC properly

Aliyun does not generate your DMARC policy; you own it. Start at p=none with a real reporting mailbox, watch aggregate reports for two to four weeks, then tighten:

_dmarc.yourdomain.com  TXT  "v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com; fo=1"

DirectMail sends transactional and marketing mail, so reports show several shared IPs. Confirm each appears in a passing SPF result before moving to quarantine. Aliyun's documentation shows p=quarantine as an example, but publishing it on day one starts by bouncing your own password resets.

If you use Alibaba Mail instead

The mailbox product has a different footprint: MX at mx1, mx2 and mx3.qiye.aliyun.com with priorities 5, 10 and 15, SPF at v=spf1 include:spf.qiye.aliyun.com -all, and a DKIM record at default._domainkey whose value comes from the admin console. DMARC is still yours. Aliyun is explicit: do not reuse a domain that already serves enterprise mail as a DirectMail sender domain — register a subdomain instead.

Verify what receivers see

Send a test message to a Gmail account and open Show original. Expect spf=pass with an Aliyun IP, dkim=pass header.d=yourdomain.com and dmarc=pass. From the outside, confirm the published records with the SPF Checker, the DKIM Checker using your region selector, the DMARC Lookup and the MX Lookup. The Email Health Check catches what you forgot.

Common mistakes

  1. Mixing DirectMail and Alibaba Mail records. Two SPF records, or an MX pointed at the wrong product, break sending and receiving.
  2. Copying a DKIM selector from another account. Selectors are region-scoped and values are per domain; only the console value is valid.
  3. Publishing DMARC as a second TXT at the wrong host. It belongs at _dmarc, and only one DMARC record may exist.
  4. Verifying too early. Aliyun advises waiting about 20 minutes; checking repeatedly before propagation only wastes attempts.
  5. Using the root domain for bulk sending. A subdomain isolates sending reputation from your corporate mail and avoids product conflicts.

Frequently asked questions

Which SPF include should I use for DirectMail?

include:spf1.dm.aliyun.com. The value spf.qiye.aliyun.com belongs to Alibaba Mail, the mailbox product. If you use both, keep a single SPF record containing both includes.

Does Aliyun generate the DKIM key?

Yes. DirectMail creates the key pair and shows the public key as a TXT value in the sender domain configuration page. You publish it; you never handle the private key.

Why does verification demand a DMARC record?

Aliyun tightened sender domain verification so that new domains must pass SPF, DKIM, DMARC and MX together. Publishing a p=none record is enough to satisfy the check.

Can I use the same domain for DirectMail and Alibaba Mail?

No. Aliyun warns against it because the MX and SPF requirements conflict. Send from mail.yourdomain.com and keep the root for mailboxes.

Was this guide helpful?