Skip to content

Spaces are accepted before @ sign #21

@dcarniel

Description

@dcarniel

Hi,

I noticed that spaces are accepted before the @ sign of the email address, values such as "jo [email protected]", "john. [email protected]" or "john.doe @example.com" are not flagged as invalid, here is an example of result obtained:

jo [email protected]:
{
  "valid": true,
  "validators": {
    "regex": {
      "valid": true
    },
    "typo": {
      "valid": true
    },
    "disposable": {
      "valid": true
    },
    "mx": {
      "valid": true
    },
    "smtp": {
      "valid": true
    }
  }
}

This test is done with the following code:

async function checkEmail( email: string ) {
  const valid = await validate({
    email: email,
    sender: email,
    validateRegex: true,
    validateMx: true,
    validateTypo: true,
    validateDisposable: true,
    validateSMTP: false,
  });
  logger.error( `${email}:\n${JSON.stringify( valid, null, 2)}` );
}

I would expect it to fail at the regexp stage. For sure an address with a space in that part is refused by email servers.

Let me known if you need any more details.
Denis

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions