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

Function extractSenderEmail

apps/sim/app/api/webhooks/agentmail/route.ts:353–363  ·  view source on GitHub ↗

* Extract the raw email address from AgentMail's from_ field. * Format: "username@domain.com" or "Display Name "

(from: string)

Source from the content-addressed store, hash-verified

351 * Format: "username@domain.com" or "Display Name <username@domain.com>"
352 */
353function extractSenderEmail(from: string): string {
354 const openBracket = from.indexOf('<')
355 const closeBracket = from.indexOf('>', openBracket + 1)
356 if (openBracket !== -1 && closeBracket !== -1) {
357 return from
358 .substring(openBracket + 1, closeBracket)
359 .toLowerCase()
360 .trim()
361 }
362 return from.toLowerCase().trim()
363}
364
365function extractDisplayName(from: string): string | null {
366 const openBracket = from.indexOf('<')

Callers 2

route.tsFile · 0.85
createRejectedTaskFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected