'use strict';
import { createTransport } from 'nodemailer';
import { getRequiredStringEnvSetting, getBooleanEnvSetting } from '../../../../../fd-toolbox/infra/env-functions.js';
import { envSettingKeys } from '../../../../common/infra/env-setting-keys.js';
import { contentFormatNames } from '../../../../../base-repo/constants/internal-common-strings.js';

var __defProp=Object['defineProperty'],__name=(_0x56db0a,_0x4f455e)=>__defProp(_0x56db0a,'name',{'value':_0x4f455e,'configurable':!![]});const smtpEmailConstants={'sendGridUser':'apikey','smtpPort':0x24b};const smtpClient=createTransport({'host':getRequiredStringEnvSetting(envSettingKeys['emailServiceUrl']),'port':smtpEmailConstants['smtpPort'],'secure':![],'auth':{'user':smtpEmailConstants['sendGridUser'],'pass':getRequiredStringEnvSetting(envSettingKeys['emailKey'])},'tls':{'rejectUnauthorized':![],'minVersion':'TLSv1.2'}});async function sendEmail(_0x5e541a,_0x2fb807=!![]){let _0x26da5f;const _0x59c593=getBooleanEnvSetting(envSettingKeys['sendEmails']);if(!_0x59c593)return _0x26da5f;return _0x26da5f=await smtpClient['sendMail']({'from':_0x5e541a['from'],'to':_0x5e541a['to'],'subject':_0x5e541a['subject'],[_0x2fb807?contentFormatNames['html']:contentFormatNames['text']]:_0x5e541a['body'],'attachments':_0x5e541a['attachments']}),_0x26da5f;}__name(sendEmail,'sendEmail');

export { sendEmail, smtpEmailConstants };
