UNPKG

@visulima/email

Version:

A comprehensive email library with multi-provider support, crypto utilities, and template engines

2 lines (1 loc) 881 B
var d=Object.defineProperty;var o=(r,e)=>d(r,"name",{value:e,configurable:!0});import a from"./validateEmail-BkVdVioP.js";var c=Object.defineProperty,t=o((r,e)=>c(r,"name",{value:e,configurable:!0}),"m");const f=t(r=>{const e=[];(!r.from||!r.from.email)&&e.push("Missing required field: from"),r.to||e.push("Missing required field: to"),r.subject||e.push("Missing required field: subject"),!r.text&&!r.html&&e.push("Either text or html content is required"),r.from&&r.from.email&&!a(r.from.email)&&e.push(`Invalid from email address: ${r.from.email}`);const s=t((i,m)=>{i&&(Array.isArray(i)?i:[i]).forEach(l=>{a(l.email)||e.push(`Invalid ${m} email address: ${l.email}`)})},"checkAddresses");return s(r.to,"to"),s(r.cc,"cc"),s(r.bcc,"bcc"),r.replyTo&&!a(r.replyTo.email)&&e.push(`Invalid replyTo email address: ${r.replyTo.email}`),e},"validateEmailOptions");export{f as default};