Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Test Email Address Deliverability in Node.js: MX Records, Null MX and the Retry Trap

Picture it: Black Friday weekend, your signup form is on fire, and somewhere in the flood is jane@gmial.com . Your app cheerfully fires off a welcome email, a receipt and a password reset to a domain that has never received a message in its life. Each one bounces. Multiply that by a busy weekend and your sending reputation starts to look like a fridge after Thanksgiving: technically still…

On Black Friday, users encountered email bouncebacks after submitting sign-up forms. This issue escalated as the weekend progressed, potentially tarnishing the reputation of the sending domain. The recommended approach to test email address deliverability during signup is to examine the domain's DNS records. This straightforward method involves checking if the domain explicitly declares its acceptance of incoming mail.

DNS checks verify if the domain can receive mail at all, addressing concerns such as typos, deceased domains, and domains explicitly refusing mail. However, DNS checks cannot determine whether a specific mailbox, like jane, exists. To validate a mailbox, a double opt-in email is necessary, which also confirms the user's intent to receive communications.

The source adheres to the rules outlined in the RFCs. The first rule is to prioritize looking up MX records for the domain. According to RFC 5321, section 5.1, if the lookup yields no MX records or encounters a temporary error, the system should proceed to retry the action at a later time. A DNS timeout should not automatically reject a signup.

When no MX records are found, the domain is implicitly granted an MX pointing to itself. This allows domains with only A or AAAA records to still accept emails. RFC 7505 specifies a null MX record, denoted by a preference of 0 and an exchange of ".", signaling that a domain does not accept email.

Furthermore, RFC 5321 sets length limitations for the local part (prior to the @ symbol) and the domain. The local part cannot exceed 64 octets, while the domain itself is limited to 255 octets. The provided Node.js code, comprising around 50 lines and lacking dependencies, implements these checks. It verifies the address's syntax, ensures local and domain lengths comply with RFC 5321, and examines the MX records for the domain.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

Choosing the Right Database on GCP: Ask What the App Does With the Data

Orders in Cloud SQL, the cart in Redis or Firestore, reports in BigQuery, and why one database is rarely enough Picture a shopping app.

  • Core data for orders, payments, and stock should live in Cloud SQL or Spanner
  • Cart managed with Firestore or Redis based on real-time updates vs fast caching
  • Product catalog stored in MongoDB Atlas or Firestore with different attributes

Billions in data centre deals grind to halt after AI chip curbs

Deals that were near the finish line are suddenly in doubt and lenders are struggling to find interested buyers.

  • US imposes new curbs on AI chip access, halting billions in loans
  • Lenders wary of stricter US export controls on data centres and neoclouds
  • Deals nearing completion now in doubt, lenders reassessing loans

More from Thursday 26 November →