Skip to content

The open alternative to Salesforce, designed for AI.

416 B
Raw Blame
import { isNonEmptyString } from '@sniptt/guards';
import { parseEmailAddressList } from 'twenty-shared/utils';

import { type EmailAddress } from 'src/modules/messaging/message-import-manager/types/email-address.type';

export const safeParseEmailAddresses = (header: string): EmailAddress[] => {
  return parseEmailAddressList(header).filter((parsedAddress) =>
    isNonEmptyString(parsedAddress.address),
  );
};