Mailgun domain verification fails: duplicate domain after Lovable move
After a Lovable workspace migration, Mailgun can block your domain because an old Mailgun account still holds it, and a domain belongs to one account. Delete the domain from the old account, re-add it in the new one, publish the fresh DNS records, and verify.
Sohail Hussain9 min readShort answer
- Mailgun allows a domain on only one account at a time, so the Mailgun account from your pre-migration Lovable project is probably still holding it.
- Log in to that account, delete the domain under Sending > Domain settings, then add it to the new account, publish the new DNS records and verify.
- If you can't get into the old account, add a different subdomain to the new account instead, or contact Mailgun support.
You moved a Lovable project to a new workspace and reconnected Mailgun. Now the domain won't add, or it adds and never verifies, and rechecking DNS changes nothing. The search that brings most people here is "mailgun duplicate domain verification failed lovable workspace migration".
I don't have one exact error string for this case, and the wording can differ between the dashboard and the API, so I won't invent one. If your screen says the domain is already registered, already in use or a duplicate, this article applies.
Why it happens
Domains in Mailgun must be unique: each domain can only exist on one account at a time, and adding an existing domain to another account fails. The rule also spans regions: the same domain can't exist in both the US and EU regions.
A Lovable workspace migration usually gives you a new project, often under a different login or email address. Reconnecting Mailgun can then create a second Mailgun account while the first one still lists your domain. The new account can't claim a name that the old one holds. That is the most common cause, and it is why DNS edits don't help.
| Cause | Symptom | Fix |
|---|---|---|
| Old Mailgun account still lists the domain | New account rejects the domain or never verifies it | Delete it from the old account |
| Old account was created by a teammate or freelancer | You can't find any Mailgun login | Search inboxes, ask the team, or use a new subdomain |
| Your user on the old account is not Admin or Developer | Delete option missing or blocked | Ask an Admin on that account to delete it |
| Old account, or another domain on it, is disabled | Delete is not possible | Contact Mailgun support |
| Free plan with one domain already added | No button to add another domain | Delete the unused domain or upgrade |
| Stale DNS from the first setup | Domain adds fine but stays unverified | Clean up old records |
The permission and disabled-account limits come from Mailgun's article on adding and deleting domains, covered below.
Step-by-step fixes
Fix 1: Find the old account and delete the domain
- Search every inbox you've used, including teammates' and any freelancer's, for Mailgun emails such as welcome, billing or DNS verification. The address on those is your old account.
- Log in to the Mailgun Control Panel with it. Use the password reset if you need to.
- Before deleting anything, export what you need (see the warning below).
- Open Sending > Domain settings, and check that the right domain is selected in the dropdown at the upper right.
- Near the bottom of the page, find the Advanced section and the Delete domain setting. Click Delete and confirm in the pop-up.
- Wait a few minutes, then add the domain to the new account.
Mailgun's article on adding and deleting a domain places the delete setting in the Advanced section of Domain settings, and says your user must be an Admin or Developer. It also says you can't delete a domain if your account is disabled, if another domain on the account is disabled, or if the domain is the sandbox domain. You can also delete from the domain list with the gear icon, or through the Domains API. Full details are in Mailgun's How can I add or delete a domain?.
Deleting removes data
Deleting a domain removes its stats, logs and stored message content within the retention period. The DKIM record, SMTP password, API key and domain sending keys also get new values on the new account. Export what you need first, and confirm nothing live still sends through the old account.
What to export, per Mailgun's transfer article:
- Stats can be exported with the Metrics API and Tags API, logs with the Logs API, and message content with the Messages API.
- Mailing lists can be exported from the Mailing List page, and routes, templates and webhooks through their APIs.
- Suppressions (bounces, complaints, unsubscribes) have an Export button on each domain's Suppressions page. If you have real customers on those lists, copy them out. Otherwise addresses that bounced or complained could receive mail again after you re-add the domain.
Mailgun has no in-app transfer feature. Deleting the domain from the old account and adding it to the new one is the way to move it.
Fix 2: Re-add and verify in the new account
- In the new account, open Sending > Domains and click Add New Domain.
- Enter the domain name. It can't be renamed later. Pick the region (US or EU) that matches where you want it to live.
- Use a subdomain such as
mg.example.comif you can. Mailgun recommends a subdomain for better email deliverability, and it avoids clashing with MX records you already use for company email. - Click Add Domain. The next page shows the DNS records required to verify the domain. They are also under Sending > Domain settings > DNS records.
- Copy each record exactly as shown into your DNS host. The DKIM selector and value will differ from the old account's. Mailgun says the selector and value are the two DKIM fields that change.
- Back in Mailgun, run the DNS check on that page. DNS changes can take a while to propagate, so if it still shows unverified, check again later rather than re-adding the domain.
- Update your Lovable project with the new Mailgun credentials. The new SMTP password and API key are in the Mailgun Control Panel after you add the domain.
Mailgun's domain verification setup guide walks through the same flow.
Check the host field
Many DNS hosts append your domain automatically. If you paste a full name like mg.example.com into such a host, you can end up with mg.example.com.example.com. Enter just mg when your DNS provider adds the root domain itself.
Fix 3: Clean up leftover DNS
Old records from the first setup can cause a second failure that looks like the first.
- Remove the old DKIM TXT record if its selector or value differs from the new one.
- Keep one SPF record per hostname. Two
v=spf1TXT records on the same name break SPF; merge them into one. - Mailgun's DNS guides say a CNAME on a hostname hides any other records on that same hostname. Don't put the tracking CNAME where TXT or MX records already live.
- Look at what the world sees with
dig -t TXT mg.example.com(swap in your own hostname) before assuming Mailgun is at fault.
If you can't get into the old account
Two routes, and the first doesn't depend on anyone else.
Use a different subdomain. Add send.example.com or mail.example.com to the new account instead, then update the sender address in your Lovable project. A different hostname shouldn't conflict with mg.example.com held by the old account. I'd try this first when the old login is lost. If Mailgun still reports a conflict on the new name, go to support.
Contact Mailgun support. Ask them to review the domain. Be ready to show you control the DNS, for example by publishing a TXT record they specify. They may tell you to delete the domain from the other account yourself, so keep looking for that login while you wait.
Checklist before you try again
- You know which email address owns the old Mailgun account.
- Your user there is an Admin or Developer.
- Nothing live still sends through the old domain.
- Logs, suppressions, lists, routes, templates and webhooks you need are exported.
- The domain is deleted in the old account, and a few minutes have passed.
- The new domain is added with records copied exactly and no doubled hostname.
- There is one SPF record per hostname, and the old DKIM record is gone.
- The new API key or SMTP password is pasted into your Lovable project.
If nothing works
Contact Mailgun support from the control panel. Include the domain name, both account emails (if you know the old one), the exact message you see, a timestamp with timezone, a screenshot, and the steps you've already tried. Say that you control the DNS.
Subject: Domain already registered on another account, cannot add or verify
Hello,
I am trying to add example.com (or mg.example.com) to my Mailgun account
{new-account-email}. It is rejected as already in use / will not verify.
The domain was previously used by another account ({old-account-email, if known})
before I migrated a Lovable project to a new workspace.
I control the DNS for this domain and can publish any TXT record you need
to prove it. Exact message: {exact message}. Time: {timestamp and timezone}.
Already tried: searched for the old account, re-added the domain,
checked DNS with dig.
Please release the domain from the old account or tell me what else you need.
Thanks,
{name}
Common questions
Can I transfer the domain instead of deleting it?
No. Mailgun has no transfer feature; the only way is to delete the domain from its current account and add it to the new one.
Can I recover a domain after deleting it?
Plan on it being gone. Mailgun's region-migration article says once a domain is deleted, its data can't be recovered. That is why exporting first matters.
Why does the new account show different DKIM values?
A domain added to a new account gets a new selector and key, so the old DKIM record won't match. Replace it with the one the new account shows.
How do I confirm SPF and DKIM pass after verifying?
Send a test message to a mailbox you control and read its headers with the email header analyzer. The guide to setting up SPF, DKIM and DMARC covers adding a DMARC record if you don't have one.
Explore: Email Deliverability
Related Articles
Apollo + Mailgun: "domain not on a Mailgun account" and IMAP
Apollo shows a "domain not being on a Mailgun account" error and asks for an IMAP host because Mailgun is a transactional sending service with no mailboxes. Verify the domain in Mailgun if you send by API; for sequences that need replies, connect a Gmail, Outlook or SMTP+IMAP mailbox instead.
Connection refused #111 on SMTP port 587: how to fix it
Connection refused #111 on port 587 means your server's TCP connection never reached the SMTP host, so a firewall, security group or hosting policy is blocking outbound traffic. Test the port with openssl s_client, open egress, switch to port 2525 or 465, or send through the provider's HTTP API instead.
DMARC Fails When SPF and DKIM Pass: Fix Alignment (550 5.7.23)
DMARC needs SPF or DKIM to pass and the passing domain to match your visible From domain. When both pass for a different domain (a vendor's bounce domain, a Mailgun subdomain), DMARC still fails. Sign DKIM with your From domain; one aligned DKIM signature is enough.
Fake Mailgun and SMTP2GO "payment information invalid" emails
An email claiming your Mailgun or SMTP2GO payment information is invalid, with a link to a lookalike domain such as smtp2go-support.sbs, is phishing. Don't click. Type the vendor's address yourself, check billing in your account, then report the message to the vendor and the domain's registrar.
Ready to supercharge your email marketing?
Start sending smarter emails with AI-powered campaigns. No credit card required.
Get Started Free