English Help Legal Sign Up Log In

Simulating email confirmation links with curl

Email confirmation turns a captured address into an active subscriber record. The topic of how to get around email confirmation links by simulating a click with curl matters when you control the signup service and need to test redirects, cookies and success states without opening a browser for every check.

A browser click is an HTTP GET followed by redirects. curl can reproduce it, but it does not remove a verification token’s security value or prove access to another person’s mailbox. The examples below assume staging tenants, dedicated test addresses and accounts you are authorised to administer.

Why confirmation redirects matter

Confirmation links commonly pass through a campaign tracker, an authentication service, a double opt-in provider and the application that owns the list. Each hop can set a cookie, expire a token or turn a valid request into a session-based activation. Testing only the visible destination hides those intermediate failures.

The useful result is not simply an HTTP 200. A sound test records the redirect sequence, final status and subscriber’s post-confirmation state. It should distinguish an expired link from a malformed URL, rejected token and downstream application error. That separation matters when list collection feeds outreach automation, CRM records or welcome messages.

Build a controlled test environment

Create a disposable subscriber in a non-production tenant and give it a unique campaign tag such as curl-check-2026-04. Use a mailbox you control, then copy the issued link exactly rather than constructing one from assumptions. A staging domain such as staging.example.test keeps production subscribers and webhooks out of the result.

Broader acquisition tooling has the same need for traceable, hygienic records; this guide to open-source outreach tools covers automation around that wider workflow. For an Australian operation, use a genuine .com.au or .au sending domain and verify SPF, DKIM and DMARC before testing, since Australian mailbox providers apply the same alignment expectations as overseas platforms.

Keep the test’s consent evidence alongside its logs. Under the Australian Spam Act 2003 and ACMA guidance, a confirmation click can evidence engagement with a specific signup process; it is not permission to add an unrelated third-party address to a campaign.

Simulate the click with curl

Store the test URL in an environment variable, then run the request:

export CONFIRM_URL='https://staging.example.test/confirm?token=TEST_ONLY_TOKEN'

curl --http1.1 -sS -L --max-redirs 5 \
  --proto '=https' --proto-redir '=https' \
  -b test-cookies.txt -c test-cookies.txt \
  -o /dev/null \
  -w '%{http_code} %{url_effective}\n' \
  "$CONFIRM_URL"

The -L option follows Location headers, while the cookie jar preserves a session across hops. The protocol flags restrict both the initial request and redirects to HTTPS, and --max-redirs prevents a redirect loop from running indefinitely. The final output provides the status and effective URL after the chain.

Run the request against the exact account used to create the subscription. A token may be bound to that account, device session, IP range or one-time nonce. If the endpoint invalidates a token after its first use, a second run may correctly fail; fresh-test automation should request a new link rather than replaying a consumed token.

Inspect each response before following it

Start with one hop when diagnosing. Removing -L and adding -D - exposes the status line, Location header and Set-Cookie value for the first response. Repeating the request for each approved destination reveals whether the tracking service redirects correctly and whether the application receives the expected cookies.

Common outcomes include 302 to a login or consent page, 200 on the success page, 400 for a malformed token, 410 for an expired one and 429 when the endpoint is rate-limited. Do not turn error responses into blind retries: honour Retry-After, keep concurrency low and record failures for review.

Remember that curl does not execute JavaScript, solve a browser challenge or bypass CAPTCHA. If confirmation requires client-side rendering, use a browser automation framework instead. If it requires a signed token, preserve its signing and expiry rules rather than weakening them for convenience.

Connect the result to list operations

Confirmation should be one state in a larger workflow. Before activation, record the address as pending; after a valid click, mark it confirmed and trigger the welcome sequence. If the request fails, retain a non-subscriber reason such as expired, bounced or unconfirmed rather than repeatedly submitting the address.

Many Australian teams use hosted services from Mailchimp, Brevo or Klaviyo, so the final state must be checked in both the application and email platform. Webhooks can report a confirmed contact, while a list sync may create a duplicate if its event key is unstable. Use the account identifier plus event type as an idempotency key.

Scheduling also needs local care. Sydney and Melbourne change time during daylight saving, while Brisbane remains on a fixed offset. A nightly batch written without that assumption can confirm tests at the wrong hour or collide with Australian sending windows.

Apply the method to real workflows

Once the controlled test passes, automate only the endpoints and addresses covered by your permission. Keep a dry-run mode that logs planned requests without following them, cap requests per mailbox and stop when the provider’s rate limit is reached. A scheduler can then retry transient network failures without turning a signup test into a high-volume link checker.

The same participation principle appears outside software: this small film club guide shows how a recurring local event gives attendees a reason to return. Email confirmation plays a similar role by establishing that a person entered a defined process rather than merely appearing in a scraped contact list.

Local outreach adds another boundary. If a form asks for a mobile number, retain that choice and consent separately; do not use email confirmation to enrol somebody into SMS. For Australian audiences, disclose the sender, maintain a working unsubscribe route and make the retention period visible so the test mirrors the live campaign rather than bypassing it.

Recommendations for dependable confirmation testing

Before putting a script into a recurring job, give the test an owner, a dedicated domain and a clear definition of success. These controls keep a useful diagnostic from becoming an unauthorised activation tool.

  • Restrict every run to staging tenants and test mailboxes the team owns or has permission to use.
  • Treat confirmation URLs as secrets and redact tokens from logs, screenshots and CI artefacts.
  • Verify the redirect chain, final status and subscriber state separately so one 200 response does not conceal failed activation.
  • Use unique campaign identifiers and idempotency keys to prevent duplicate contacts in the CRM.
  • Retain consent records and align test timing with Australian sending practices and provider rate limits.

A dependable result ends with one expected database record, one successful provider event and no production subscriber in the test set. The same evidence remains available to an Australian operator reviewing consent, deliverability and list hygiene.