How-To

Mailgun: "The 'address' parameter should be a valid email address"

Mailgun returns this error when the address sent to its mailing list API is empty or malformed. The usual causes are a blank field in your export, stray whitespace, a display name mixed into the address, or an unencoded plus sign. Find the bad value, clean it, and resend.

Sohail HussainSohail Hussain7 min read

Short answer

  • Mailgun received an address value it could not read as one bare email address. The most common cause is an empty value, so check for blank rows first.
  • Then look for spaces, display names like Jane Doe in angle brackets, two addresses in one field, and a plus sign that was not URL-encoded.
  • Trim and validate every address before you send, and put the name in the separate name parameter.

You are adding people to a Mailgun mailing list, through the API or through a plugin or export tool that calls it, and the request fails with this:

The 'address' parameter should be a valid email address

The message does not say which row failed. This guide shows how to find the bad value, fix it, and stop it from coming back.

Why it happens

Mailgun's mailing list endpoints take an address parameter for each member. Adding one member with POST /v3/lists/{list_address}/members carries one address; the bulk endpoint takes a JSON array of members.

The error is an input-validation failure, which Mailgun returns as a client-side error (HTTP 400). Nothing is wrong with your domain, DNS, sending reputation or API key. The API simply would not accept the string you put in address. Users on community forums report the same message when exporting from WordPress to a Mailgun list through an export plugin, which points to a data or mapping problem rather than a Mailgun fault.

Causes, most common first:

CauseWhat you seeFix
Blank addressRequest has address= with nothing after itSkip empty rows, fix the column mapping
Whitespace or hidden charactersAddress looks fine on screen but failsTrim, strip mailto:, brackets, quotes
Several things in one fieldTwo addresses, or a display name mixed inOne bare address per member
Raw + in a form-encoded bodyjane+news@example.com arrives as jane news@example.comLet your HTTP library encode the field
One bad entry in a bulk uploadWhole request fails, no row namedBisect the batch, then validate first

Step-by-step fixes

1. Check for a blank address

This is the likeliest cause. A mapping points at the wrong column, a user record has no email, or a template variable never got filled, so the request goes out with an empty address.

  1. Log the exact request body just before it is sent.
  2. If you import from a CSV, scan the email column for empty cells.
  3. Skip any record whose address is empty after trimming.
  4. Correct the field mapping so it points at the real email column.

Tools that loop over records (export plugins, automation steps, scripts) can stop on the first empty one and report only that, so one blank row can hide others.

2. Strip whitespace and hidden characters

A trailing space, a newline from a CSV line ending, or a non-breaking space copied from a spreadsheet can fail validation even though the address looks fine.

  1. Trim the value before sending.
  2. Remove a leading mailto: if your data came from web links.
  3. Remove surrounding angle brackets or quotes.

Spreadsheet exports

Spreadsheet exports sometimes start with a byte-order mark that breaks the first column name and produces blanks. Open the file as UTF-8 with BOM handling, as in the script below.

3. Send one bare address per member

These all fail:

  • jane@example.com, bob@example.com (two addresses in one field)
  • Jane Doe <jane@example.com> (display name mixed in)
  • jane@example,com (comma typo)
  • jane@example (no top-level domain)

Split multi-address cells into separate rows. Put the person's name in the separate name parameter.

4. Encode the plus sign

Addresses like jane+news@example.com are valid. But if you build a form-encoded request by hand and leave the + raw, the server decodes it as a space, and jane news@example.com is not valid. Let your HTTP library encode form fields, or use -F with curl:

curl -s --user 'api:YOUR_API_KEY' \
  https://api.mailgun.net/v3/lists/lists@example.com/members \
  -F address='jane+news@example.com' \
  -F name='Jane Doe' \
  -F subscribed=true

The same applies if the address sits in the URL path when you update or delete a member: encode it there too. EU-region accounts use api.eu.mailgun.net instead.

5. Find the bad row in a bulk upload

With the bulk endpoint (/members.json), one malformed entry in the members array can fail the request, and the response may not name the entry. Bisect it:

  1. Split the batch in half and resend each half.
  2. Keep halving the half that fails.
  3. Stop when one entry remains; that is your offender.

Better, validate before you batch.

Validate before you send

A small pre-flight check removes most of these failures. It does not need to be a full RFC parser; it only needs to catch obvious breakage:

import csv, re

pattern = re.compile(r"^[^@\s,<>;]+@[^@\s,<>;]+\.[^@\s,<>;]+$")

good, bad = [], []
with open("export.csv", newline="", encoding="utf-8-sig") as f:
    for row in csv.DictReader(f):
        email = (row.get("email") or "").strip().lower()
        (good if pattern.match(email) else bad).append(row)

print(len(good), "ok;", len(bad), "rejected")

Write the bad rows to a file and read them. You will usually see a pattern, such as one data source that leaves the field empty. The utf-8-sig encoding drops the byte-order mark mentioned above.

Syntax checking only proves the string is shaped like an address, not that the mailbox exists. For that, see our notes on validation and email list hygiene. Addresses that pass syntax but do not exist show up later as a hard bounce.

Checklist before you try again

  • No empty address values after trimming.
  • One bare address per member, no display names, no commas or semicolons.
  • No mailto:, angle brackets or quotes around the value.
  • The + and other special characters are encoded by your HTTP library.
  • The name is in the name parameter, not in address.
  • You are calling the right region host (US or EU).

If nothing works

If every address in the payload is clean and the error persists, contact Mailgun support through your Mailgun account. Include:

  • The exact request (endpoint and parameters, with the API key removed).
  • The full JSON response and the timestamp.
  • Your region (US or EU) and the list address.
  • One example address that fails, with its raw bytes if you suspect hidden characters.

That helps them tell whether the rejection is a parsing quirk on their side, for example with an internationalized domain, rather than a data problem. Check Mailgun's own documentation for current parameter rules, since they can change.

Subject: 400 "The 'address' parameter should be a valid email address" on list member add

Hi, adding members to the list {list-address} (region: {US or EU}) fails with:
The 'address' parameter should be a valid email address

Endpoint: {endpoint}
Timestamp (UTC): {timestamp}
Example failing address: {address}
Already tried: trimmed whitespace, removed display names, URL-encoded the field, bisected the batch.
Full request (API key removed) and response attached.

Can you confirm why this value is rejected?

Preventing it

  • Reject empty or malformed addresses where you collect them, not at upload.
  • Normalize on the way in: trim, lowercase, strip mailto: and brackets.
  • Keep the name in a separate field from the address.
  • Log the rejected rows from every import so a recurring bad source gets noticed.

Common questions

Does this error mean my Mailgun account or domain has a problem?

No. It is an input-validation error on the request, not a DNS, reputation or API key issue.

Is an address with a plus sign valid?

Yes, jane+news@example.com is valid. It fails only when the plus sign is sent unencoded in a form body and arrives as a space.

Why does the error not tell me which row failed?

For bulk requests the response may reject the whole batch without naming the entry. Bisecting the batch or validating locally first is the practical way to find it.

Will passing this check mean the email will be delivered?

No. It only means the string looks like an address. A mailbox that does not exist will bounce later.

strategymailgunerror-codes
Share this article
Sohail Hussain

Sohail Hussain

Founder & CEO at Mailneo

Building Mailneo — AI-powered email marketing for growing businesses.

Ready to supercharge your email marketing?

Start sending smarter emails with AI-powered campaigns. No credit card required.

Get Started Free