📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

mailbox-address

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mailbox-address

Validate syntax for a RFC 5321/6531(SMTPUTF8) email mailbox address.

1.0.3
latest
Source
npm
Version published
Weekly downloads
78
-13.33%
Maintainers
1
Weekly downloads
 
Created
Source

mailbox-address

Validate syntax for a RFC 5321/6531(SMTPUTF8) email mailbox address.

Installing

For the latest stable version:

npm install mailbox-address

Usage in Typescript

import { validate, MailboxType } from "mailbox-address";

const address = "Διεθνές@Greek.com";
const valid = mailboxAddress.validate(address, MailboxType.SMTPUTF8);
if (valid) {
  console.log(`${valid} is a valid internationalized (SMTPUTF8) email mailbox address.`);
} else {
  console.log(`${address} is NOT a valid internationalized (SMTPUTF8) email mailbox address.`);
}

Usage in the browser via UNPKG

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<script src="https://unpkg.com/mailbox-address"></script>
</head>
<body>
<p>Try playing with <code>mailboxAddress</code> in the console.</p>
<p><b id="address"></b> is a <b id="valid"></b> internationalized (SMTPUTF8) email mailbox address.</p>
<script>
const SMTPUTF8 = 1;
const address = "Διεθνές@Greek.com";
const valid = mailboxAddress.validate(address, SMTPUTF8);
document.getElementById('address').innerText = valid || address;
document.getElementById('valid').innerText = valid ? 'valid' : 'invalid';
</script>
</body>
</html>

API docs

validate(mailbox: string, type?: MailboxType): string | false

License

MIT

Keywords

RFC5321

FAQs

Package last updated on 13 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts