Member-only story

Real Email Validation using Mailgun in Laravel

Hafiq Iqmal
3 min readJul 22, 2022

--

Email is one of the most preferred and effective communication channels, with most people checking their emails daily. Study said only 10% of email addresses collected are accurate which is mostly due to human error. As a developer or the owner of the system, email validation are one of the important things to do especially when the system have registration form.

Laravel already provides features with a wide options when it comes to email validation such as :-

  • RFC Standard validation (rfc, strict)
  • DNS Check Validation (dns)
  • Spoof Check Validation (spoof)
  • Email Filter Validation (filter)

By default, Laravel email validation doesn’t come with real email validation upfront. Even though we can send an email with OTP or links to verify, it would require the system to store the data temporarily in the database and mark it as unverified for a while.

Here come Mailgun Verification API. Mailgun Verification API will verify the given address based on:

  • Mailbox detection
  • Syntax checks (RFC defined grammar)
  • DNS validation
  • Spell checks
  • Email Service Provider (ESP) specific local-part grammar (if…

--

--

Hafiq Iqmal
Hafiq Iqmal

Written by Hafiq Iqmal

Technical Lead | Software Engineer | Laravel Enthusiasts | Tech writer | UiTM Alumni | Husband | Proud father of a beautiful daughter

No responses yet