fix: @ symbol in the from field with friendly name (#174)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: KM Koushik <koushikmohan1996@gmail.com>
This commit is contained in:
committed by
GitHub
parent
3212613273
commit
142084af8e
@@ -9,7 +9,10 @@ import { UnsendApiError } from "../public-api/api-error";
|
||||
const dnsResolveTxt = util.promisify(dns.resolveTxt);
|
||||
|
||||
export async function validateDomainFromEmail(email: string, teamId: number) {
|
||||
let fromDomain = email.split("@")[1];
|
||||
// Extract email from format like 'Name <email@domain>' this will allow entries such as "Someone @ something <some@domain.com>" to parse correctly as well.
|
||||
const match = email.match(/<([^>]+)>/);
|
||||
let fromDomain = match ? match[1].split("@")[1] : email.split("@")[1];
|
||||
|
||||
if (fromDomain?.endsWith(">")) {
|
||||
fromDomain = fromDomain.slice(0, -1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user