Troubleshooting

Mail that doesn't arrive, 401 and 403 answers, 429 and Retry-After, and waits that time out.

Mail doesn't arrive

Your app's mail log, or the bounce, shows Mayfly's reply.

  • 550 5.1.2 Domain not accepted here: no domain of yours. Check the private test domain on Overview, since a rotated one is refused. An own domain takes mail only while verified or failing, its MX record on mx.wcmone.info.
  • 550 5.7.1 Refused as spam by this domain's filter: the spam filter is set to Reject. Settings → Spam filter lists each refusal. Tag only marks the mail, and the wait still returns it.
  • 452 4.2.2 Monthly mail limit reached: see At the limit.

401 and 403

  • 401 unauthorized: the key is missing, wrong or revoked, or not sent as Authorization: Bearer. Keys work on the mail, mailbox, usage, overview and domain list calls only; the rest need a signed-in admin.
  • 403 plan_feature_unavailable: not on the plan, such as attachments on the Developer plan. The mail's attachmentsDownloadable says so first.
  • 403 bad_origin: a write that sent a session cookie. Send the key alone.

429

A 429 says how many seconds to wait in Retry-After. Its code says which limit: rate_limited is 600 requests a minute per key, with a ceiling for the whole workspace; waits_full is 20 waits at once per key, with caps for the workspace and the server.

mayfly.mjs
// Wait out a 429 once, for as long as Retry-After says, then try again.
async function mayfly(url, headers) {
  const response = await fetch(url, { headers });
  if (response.status !== 429) return response;
  const seconds = Number(response.headers.get("retry-after") ?? 1);
  await new Promise((resolve) => setTimeout(resolve, seconds * 1000));
  return fetch(url, { headers });
}

Waits that time out

A 404 wait_timeout means no matching mail arrived in time.

  • Check the mail was sent, to that address.
  • Take since from Mayfly's Date header: a test machine's clock running ahead hides the very mail.
  • Give your HTTP client a longer timeout than the wait's. This server allows up to 90 seconds; more is a 400.

The wrong mail

The wait returns the newest matching mail since since: a mail from an earlier run means since was missing or too early. Filter by part of the subject or from. For the mail after one the wait gave you, pass its id as after: it finds only later mail, so it's no starting point.

wait.mjs
// Pick the mail out by part of its subject (or with "from"), from the same since.
const query = new URLSearchParams({
  to: address,
  since,
  subject: "verification code",
  timeout: "30",
});
let answer = await fetch(`${MAYFLY}/api/v1/wait?${query}`, { headers });

// Or wait for the next mail after the one the wait just gave you.
query.set("after", (await answer.json()).id);
answer = await fetch(`${MAYFLY}/api/v1/wait?${query}`, { headers });

Every parameter is in the API reference.

NextYour own domain