MCPcopy Index your code
hub / github.com/simstudioai/sim / quickValidateEmail

Function quickValidateEmail

apps/sim/lib/messaging/email/validation.ts:73–135  ·  view source on GitHub ↗
(email: string)

Source from the content-addressed store, hash-verified

71 * Quick email validation for client-side form feedback.
72 */
73export function quickValidateEmail(email: string): EmailValidationResult {
74 const checks = {
75 syntax: false,
76 domain: false,
77 mxRecord: true,
78 disposable: false,
79 }
80
81 checks.syntax = validateEmailSyntax(email)
82 if (!checks.syntax) {
83 return {
84 isValid: false,
85 reason: 'Invalid email format',
86 confidence: 'high',
87 checks,
88 }
89 }
90
91 const domain = email.split('@')[1]?.toLowerCase()
92 if (!domain) {
93 return {
94 isValid: false,
95 reason: 'Missing domain',
96 confidence: 'high',
97 checks,
98 }
99 }
100
101 checks.disposable = !isDisposableEmail(email)
102 if (!checks.disposable) {
103 return {
104 isValid: false,
105 reason: 'Disposable email addresses are not allowed',
106 confidence: 'high',
107 checks,
108 }
109 }
110
111 if (hasInvalidPatterns(email)) {
112 return {
113 isValid: false,
114 reason: 'Email contains suspicious patterns',
115 confidence: 'medium',
116 checks,
117 }
118 }
119
120 checks.domain = domain.includes('.') && !domain.startsWith('.') && !domain.endsWith('.')
121 if (!checks.domain) {
122 return {
123 isValid: false,
124 reason: 'Invalid domain format',
125 confidence: 'high',
126 checks,
127 }
128 }
129
130 return {

Callers 15

validation.test.tsFile · 0.90
auth.tsFile · 0.90
validateEmailFunction · 0.90
contact.tsFile · 0.90
demo-requests.tsFile · 0.90
validateBulkInvitationsFunction · 0.90
sendPaymentFailureEmailsFunction · 0.90
DemoFormFunction · 0.90
sendCodeFunction · 0.90
handleAuthenticateFunction · 0.90
isValidEmailEntryFunction · 0.90
OrganizationInviteModalFunction · 0.90

Calls 3

validateEmailSyntaxFunction · 0.85
isDisposableEmailFunction · 0.85
hasInvalidPatternsFunction · 0.85

Tested by

no test coverage detected