mailpop 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -234,7 +234,8 @@ Options:
234
234
  let discoveryMethod = result.selectedEmail ? result.selectedEmail.discoveryMethod : '';
235
235
  // If no email detected, try to fall back to hello@domain
236
236
  if (!selectedEmail) {
237
- const fallbackEmail = `hello@${target.domain}`;
237
+ const fallbackDomain = normalizeDomain(target.domain);
238
+ const fallbackEmail = `hello@${fallbackDomain}`;
238
239
  const isFallbackValid = await verifyEmailFallback(fallbackEmail);
239
240
  if (isFallbackValid) {
240
241
  selectedEmail = fallbackEmail;
@@ -2,6 +2,8 @@ import { normalizeDomain } from './normalize.js';
2
2
  import { config } from '../config.js';
3
3
  import dns from 'dns/promises';
4
4
  const EMAIL_REGEX = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
5
+ const MAX_EMAIL_LENGTH = 254;
6
+ const MAX_LOCAL_PART_LENGTH = 64;
5
7
  const REJECTED_PREFIXES = [
6
8
  'noreply',
7
9
  'no-reply',
@@ -34,6 +36,9 @@ const REJECTED_DOMAINS = [
34
36
  * @param email - The email to check.
35
37
  */
36
38
  export function isValidEmail(email) {
39
+ if (email.length > MAX_EMAIL_LENGTH) {
40
+ return false;
41
+ }
37
42
  if (!EMAIL_REGEX.test(email)) {
38
43
  return false;
39
44
  }
@@ -43,6 +48,9 @@ export function isValidEmail(email) {
43
48
  }
44
49
  const localPart = parts[0].toLowerCase().trim();
45
50
  const domainPart = parts[1].toLowerCase().trim();
51
+ if (localPart.length > MAX_LOCAL_PART_LENGTH) {
52
+ return false;
53
+ }
46
54
  // Reject blacklisted prefixes
47
55
  if (REJECTED_PREFIXES.includes(localPart)) {
48
56
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mailpop",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Production-ready public contact email discovery tool from company websites.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",