DEV Community

Password Reset Email Spam: How to Trace 3 Signals Before Receipts Stall

The receipt needs to reach the customer after payment settles.

Start with a managed email service and a small reconciliation worker: the page worth investigating is a growing gap between settled orders and receipts with delivery evidence, especially when support also reports that password reset emails are landing in spam.

In this illustrative B2B SaaS runbook, the on-call sees those two signals together. They are a reason to investigate a shared sender, not proof of a shared cause.

TL;DR: Password reset emails can land in spam because SPF, DKIM, or DMARC authentication is missing or invalid, the template resembles phishing, the body contains excessive or suspicious links, receiving servers classify bulk traffic as spam, or low engagement damages sender scoring. For the receipt workflow, trace authentication, message content, and recipient evidence before changing providers.

An accepted send request doesn't establish inbox placement. Count the gap.

The numbers below are proposed operating assumptions and local test inputs, not incident measurements or vendor performance claims. The editorial angle is alert quality: which signal should have warned the platform team before customers started asking where their receipts went?

What causes password reset emails to land in spam before receipts stall?

A delivery SLO needs an observable boundary. โ€œCustomers receive their receiptsโ€ is the outcome, but an application cannot infer that outcome from its send counter; define a separate objective for dispatch after settlement, track the delivery evidence available from the provider, and label inbox placement as unknown unless recipient-side evidence resolves it.

Keep password reset traffic distinguishable from receipts even when both use the same sender domain, because a spike in reset requests should not silently rewrite the receipt denominator.

For a planning example, choose a five-minute dispatch objective and a 30-second reconciliation interval. These are starting assumptions to review with the business.

A worker that notices a settled order without a corresponding receipt dispatch can act on evidence the application owns; an alert that calls every missing open a delivery failure cannot. The earlier signal is authentication drift or a growing delivery-evidence backlog, depending on what the investigation finds.

Check the sender domain and a recipient's actual message headers. A configured DNS record and a successful authentication result on the message are different observations. SPF, DKIM, and DMARC belong in the investigation because missing or invalid authentication can contribute to spam classification; even passing results cannot certify the template or the recipient's classification decision.

Keep the evidence explicit. This first local program records a manually inspected header sample and separates a definite authentication concern from an unresolved placement question.

Save it as headers.go and run it with go run headers.go; its fields are application-owned evidence labels, not a provider response schema.

package main
import "fmt"
type HeaderSample struct {
  OrderID string
  SPF string
  DKIM string
  DMARC string
}
func main ( ) {
  sample := HeaderSample { OrderID : "order-b2b-285" , SPF : "pass" , DKIM : "fail" , DMARC : "fail" , }
  if sample . SPF != "pass" || sample . DKIM != "pass" || sample . DMARC != "pass" {
    fmt . Printf ( "%s: investigate authentication; inbox placement unknown\n" , sample . OrderID )
    return
  }
  fmt . Printf ( "%s: inspect content and recipient evidence next\n" , sample . OrderID )
}

The judgment criterion is deliberately narrow: an observed failure earns investigation, while three passes move the investigation forward. Don't turn this diagnostic branch into an assertion that every non-pass result caused spam placement.

Follow the message before buying another integration

Inspect the reset template beside the receipt template. Poorly designed templates and content resembling phishing can contribute to classification, and a message with excessive URLs or suspicious links deserves scrutiny before the team spends a sprint moving the same content to another provider.

A proposed review rule is one clearly explained action for a reset email, with the expected destination visible to the reviewer; that is a content discipline, not a promise that one link will pass every spam filter.

Bulk classification and low engagement complicate the picture. A receiving server may misidentify bulk-sent messages, and low engagement can influence sender scoring, but neither fact licenses a simplistic โ€œnobody clicked, therefore delivery failedโ€ alert. Separate observations from explanations.

Retain the message identifier and template revision in the application record, and investigate the recipient's actual classification where available, without copying reset tokens into operational logs.

This is also where buy-versus-build becomes concrete. The alternative stack of Clerk, Resend, and Twilio requires three vendor signups and three sets of credentials; the application must connect account identity to email delivery and SMS fallback, then reconcile how each integration represents suppression. That mapping remains business logic even when one interface makes the transport setup smaller.

  • Clerk in the alternative stack - Account identity integration - Evaluate account requirements first; the email delivery investigation still needs its own evidence.
  • Resend in the alternative stack - Transactional email integration - Evaluate email requirements separately; account lookup and SMS handoff require application glue.
  • Twilio in the alternative stack - SMS fallback integration - Evaluate the fallback channel; an SMS handoff does not resolve the email's spam classification.
  • SendGrid as an email candidate - A separate email-service selection - Compare with Resend when retaining a dedicated email boundary; account and SMS coordination still need an owner.
  • Combined service interface - Account, email, and SMS integration through one contract - Reduces credential boundaries; the application still owns eligibility, reconciliation, and its SLO.
  • Application-owned coordinator - Settlement-to-receipt state and evidence - Adds engineering and on-call work, but preserves a business-specific audit trail.

Infrai fits the combined-service option with 295 routes across 20 modules behind one key and a consistent REST contract, so the account lookup, welcome email, receipt, and SMS fallback can share integration conventions; its specified idempotency convention is a separate advantage to evaluate for supported write operations. The cost is one vendor to trust, one bill, and one outage surface.

Its pull-based event model means the coordinator must budget for polling, while an email-code fallback requires application-owned verification logic; direct API integration is the relevant deployment model here, and SMS eligibility and geographic abuse controls remain business responsibilities.

Choose the boundary before choosing the logo. The trade-off is reduced integration work versus concentrated vendor dependency. A combined interface is not a fit when independently replaceable providers are a hard requirement; prefer the separate-service stack in that case.

For a team whose requirement is SMTP relay, additional messaging channels, or a particular domestic compliance basis, that combined-service description alone is insufficient evidence for selection. Compare those requirements explicitly rather than assuming breadth settles them.

Instrument the account-to-receipt handoff

The instrumentation change is to preserve the business identifier through the handoff and count unresolved work by age. A provider request count loses the settled order, an account lookup can return the wrong recipient, and a fallback decision can ignore suppression unless the coordinator keeps those concerns together.

Use an application-owned record linking the order, account, template revision, and current receipt state; keep credentials and reset links out of that record.

The following executable harness demonstrates the first capability's output feeding the second with the same key and base URL configuration. Both adapters are local: this tests the handoff and alert decision without sending a message or pretending that application fields are vendor API fields.

Set SERVICE_API_KEY and SERVICE_BASE_URL for the intended service, save the program as handoff.go, and run go run handoff.go. Production adapters must use the service's declared request and response schemas; this harness makes no claim to implement them.

package main
import (
  "errors"
  "fmt"
  "os"
  "time"
)
type Config struct {
  Key string
  BaseURL string
}
type Account struct {
  ID string
  Email string
  Suppressed bool
}
func lookupAccount ( c * Config , id string ) ( Account , error ) {
  if c . Key == "" || c . BaseURL == "" || id == "" {
    return Account { } , errors . New ( "service configuration and account ID required" )
  }
  return Account { ID : id , Email : "b******@example.com" } , nil
}
func prepareReceipt ( c * Config , a Account , order string ) ( string , error ) {
  if c . Key == "" || c . BaseURL == "" || a . Email == "" || order == "" {
    return "" , errors . New ( "receipt handoff incomplete" )
  }
  if a . Suppressed {
    return "" , errors . New ( "recipient suppressed: review eligibility" )
  }
  return order + "๐Ÿงพ" + a . ID , nil
}
func run ( ) error {
  c := & Config { Key : os . Getenv ( "SERVICE_API_KEY" ) , BaseURL : os . Getenv ( "SERVICE_BASE_URL" ) }
  account , err := lookupAccount ( c , "account-285" )
  if err != nil {
    return err
  }
  intentID , err := prepareReceipt ( c , account , "order-b2b-285" )
  if err != nil {
    return err
  }
  const objective = 5 * time . Minute
  const pollInterval = 30 * time . Second
  const observedAge = 6 * time . Minute
  fmt . Printf ( "intent=%s page=%t poll=%s; local simulation, no send\n" , intentID , observedAge > objective + pollInterval , pollInterval )
  return nil
}
func main ( ) {
  if err := run ( ) ; err != nil {
    fmt . Fprintln ( os . Stderr , err )
    os . Exit ( 1 )
  }
}

The test criterion is reproducible: a six-minute-old unresolved dispatch exceeds the illustrative five-minute objective plus one polling interval. Changing Suppressed to true must stop receipt preparation. Neither result proves that a recipient received an email, and the deterministic intent identifier becomes useful for retries only when a durable coordinator and the selected write operation enforce deduplication.

Before replacing the local adapters, retrieve the actual domain-verification contract. This runnable preflight calls the public discovery surface and prints the declared schema, rather than guessing the inputs to a write operation.

Configure INFRAI_API_KEY and INFRAI_BASE_URL with the service's documented versioned base URL, save as contract.go, and run go run contract.go. A successful response gives the integration reviewer a contract to inspect; it does not verify a sender domain or send a receipt.

package main
import (
  "encoding/json"
  "fmt"
  "io"
  "net/http"
  "os"
  "strconv"
  "strings"
  "time"
)
func run ( ) error {
  key := os . Getenv ( "INFRAI_API_KEY" )
  base := strings . TrimRight ( os . Getenv ( "INFRAI_BASE_URL" ) , "/" )
  if key == "" || ! strings . HasPrefix ( base , "https://" ) {
    return fmt . Errorf ( "set API key and HTTPS versioned base URL" )
  }
  client := & http . Client { Timeout : 15 * time . Second }
  for attempt := 0 ; attempt < 4 ; attempt ++ {
    req , err := http . NewRequest ( http . MethodGet , base + "/discovery/email.domain.verify" , nil )
    if err != nil {
      return err
    }
    req . Header . Set ( "Authorization" , "Bearer " + key )
    resp , err := client . Do ( req )
    if err != nil {
      return err
    }
    body , readErr := io . ReadAll ( resp . Body )
    resp . Body . Close ( )
    if readErr != nil {
      return readErr
    }
    if resp . StatusCode == http . StatusTooManyRequests && attempt < 3 {
      delay := time . Second * time . Duration ( 1 << attempt )
      retry := resp . Header . Get ( "Retry-After" )
      if seconds , err := strconv . Atoi ( retry ) ; err == nil && seconds >= 0 {
        if d := time . Duration ( seconds ) * time . Second ; d > delay {
          delay = d
        }
      } else if date , err := http . ParseTime ( retry ) ; err == nil {
        if d := time . Until ( date ) ; d > delay {
          delay = d
        }
      }
      time . Sleep ( delay )
      continue
    }
    if resp . StatusCode < 200 || resp . StatusCode >= 300 {
      return fmt . Errorf ( "discovery HTTP %d: %s" , resp . StatusCode , body )
    }
    if ! json . Valid ( body ) {
      return fmt . Errorf ( "discovery returned invalid JSON" )
    }
    fmt . Println ( string ( body ) )
    return nil
  }
  return fmt . Errorf ( "retry budget exhausted" )
}
func main ( ) {
  if err := run ( ) ; err != nil {
    fmt . Fprintln ( os . Stderr , err )
    os . Exit ( 1 )
  }
}

That persistence is the production boundary. Commit a dispatch intent with the settled-order state, deduplicate worker execution against that intent, and reconcile uncertain send outcomes before retrying. Suppression needs a review path, not an automatic switch to SMS; use independently established fallback eligibility, and don't transplant a receipt fallback rule into password recovery without reviewing its security consequences.

Tune the page against its false-positive cost

Capacity planning starts with the reconciliation loop. Under the illustrative assumption of one status lookup for each unresolved message every 30 seconds, 300 unresolved messages consume 10 lookups per second before retries. That arithmetic describes a proposed workload, not a service limit. Size worker concurrency against documented limits, back off on rate limiting, and include the polling interval in any claim about detection delay.

Page on actionable evidence. Setting the threshold below a full polling interval can page the team while the next observation is still pending; setting it far above the dispatch objective hides a customer-visible backlog. Require sustained evidence across observations, distinguish teleme

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.