Liking cljdoc? Tell your friends :D

net.curiousprogrammer.email

Basic utilities for checking emails. The core function is verify! which can perform multiple checks depending on the options.

You can also call validate (basic syntax check) and disposable? separately.

Basic utilities for checking emails.
The core function is `verify!` which can perform multiple checks
depending on the options.

You can also call `validate` (basic syntax check) and `disposable?` separately.
raw docstring

disposable-domain?clj

(disposable-domain? email-domain)

Checks the email domain against the predefined list of disposable email domains available at https://disposable.github.io/disposable-email-domains/. The list is loaded only once and then cached afterward throughout the lifetime of the process.

Checks the email domain against the predefined list of disposable email domains
available at https://disposable.github.io/disposable-email-domains/.
The list is loaded only once and then cached afterward throughout the lifetime of the process.
raw docstring

disposable-domainsclj


disposable?clj

(disposable? email)

Checks if given email is a disposable email address. See https://blog.kickbox.com/what-is-a-disposable-email-address/

See also disposable-domain?.

Checks if given email is a disposable email address.
See https://blog.kickbox.com/what-is-a-disposable-email-address/

See also `disposable-domain?`.
raw docstring

email-domainclj

(email-domain email)

email-regexclj


validateclj

(validate email)

A basic validation of an email - syntactical check. Returns nil if the email is valid, error message otherwise.

This is a little library that does something similar: https://github.com/lamuria/email-validator

For info about browsers and the 'email' input type: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#validation

For a more thorough see verify!.

A basic validation of an email - syntactical check.
Returns nil if the email is valid, error message otherwise.

This is a little library that does something similar: https://github.com/lamuria/email-validator

For info about browsers and the 'email' input type: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#validation

For a more thorough see `verify!`.
raw docstring

verify!clj

(verify! email
         &
         {:keys [check-disposable check-mx-record check-recipient
                 check-recipient-mail-from]
          :or {check-disposable true
               check-mx-record true
               check-recipient false
               check-recipient-mail-from "no-reply@example.com"}
          :as _options})

More thorough email validation (aka "verification") including:

Options can be specified as a final hashmap-like argument:

  1. :check-disposable (default: true) - checks that the email domain is not disposable like mailinator.com.
  2. :check-mx-record (default: true) - checks that the email domain has a valid mx record.
  3. :check-recipient (default: false) - tries to perform real SMTP transaction with the mx server to determine if the recipient's email address is valid. It requires :check-mx-record to be true. It's false by default since it involves a full SMTP transaction which is more prone to failures than the other simpler checks. The check-recipient-mail-from parameter is used for in check-recipient! for the 'MAIL FROM' smtp param. It defaults to 'no-reply@example.com'.

Returns a map structure describing the validation result:

  • :valid? - overall result of the validation, true or false; depends on the options
  • :email-domain - domain derived from the given email
  • :format-error - string description of a syntactic error with given email address as per validate, or nil of the format is valid
  • :disposable - true if the email's domain is disposable (such as mailinator.com), false if the domain is not disposable, :unknown if it couldn't be checked (due to a network error such as request timeout)
  • :mail-server - the mail server (if any) retrieved via the email domain's MX record or :unknown if the check-mx-record was set to false
  • :recipient-error - the error (if any) received during check-recipient smtp verification process

See also https://mailtrap.io/blog/verify-email-address-without-sending/ for more information about the whole email validation & verification process.

More thorough email validation (aka "verification") including:
- Syntax validation (same as `validate`)
- Check for disposable emails (ala mailinator.com)
- DNS lookup (via dnsjava lib: https://github.com/dnsjava/dnsjava/blob/master/EXAMPLES.md)
- Email box ping

Options can be specified as a final hashmap-like argument:
---------------------------------------------------------
1. `:check-disposable` (default: true) -  checks that the email domain is not disposable like `mailinator.com`.
2. `:check-mx-record` (default: true) -  checks that the email domain has a valid mx record.
3. `:check-recipient` (default: false) -  tries to perform real SMTP transaction with the mx server
    to determine if the recipient's email address is valid.
    It requires `:check-mx-record` to be `true`.
    It's `false` by default since it involves a full SMTP transaction which is more prone to failures
    than the other simpler checks.
    The `check-recipient-mail-from` parameter is used for in `check-recipient!` for the 'MAIL FROM' smtp param.
    It defaults to 'no-reply@example.com'.

Returns a map structure describing the validation result:
- `:valid?` - overall result of the validation, true or false; depends on the options
- `:email-domain` - domain derived from the given email
- `:format-error` - string description of a syntactic error with given email address as per `validate`,
                    or `nil` of the format is valid
- `:disposable` -  true if the email's domain is disposable (such as mailinator.com),
                   false if the domain is not disposable,
                   :unknown if it couldn't be checked (due to a network error such as request timeout)
- `:mail-server` - the mail server (if any) retrieved via the email domain's MX record
                   or :unknown if the `check-mx-record` was set to false
- `:recipient-error` - the error (if any) received during `check-recipient` smtp verification process

See also https://mailtrap.io/blog/verify-email-address-without-sending/
for more information about the whole email validation & verification process.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close