From fb276ed3db86fe4fc0c0fcd870fd3d085b034be0 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Thu, 17 Jul 2025 10:50:28 +0000 Subject: (대표님) 벤더데이터 S-EDP 변경사항 대응(seperator), 정기평가 점수오류, dim 준비 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/mail/sendEmail.ts | 9 +- lib/mail/templates/tech-vendor-invitation.hbs | 148 +++++++++++ lib/mail/templates/vendor-evalution-request.hbs | 327 ++++++++++++++++++++++++ 3 files changed, 482 insertions(+), 2 deletions(-) create mode 100644 lib/mail/templates/tech-vendor-invitation.hbs create mode 100644 lib/mail/templates/vendor-evalution-request.hbs (limited to 'lib/mail') diff --git a/lib/mail/sendEmail.ts b/lib/mail/sendEmail.ts index b4d2707a..3b358ea8 100644 --- a/lib/mail/sendEmail.ts +++ b/lib/mail/sendEmail.ts @@ -8,6 +8,7 @@ interface SendEmailOptions { template: string; // 템플릿 파일명(확장자 제외) context: Record; // 템플릿에 주입할 데이터 cc?: string | string[]; // cc 필드 추가 - 단일 이메일 또는 이메일 배열 + from?: string; // from 필드 추가 - 옵셔널 attachments?: { // NodeMailer "Attachment" 타입 filename?: string @@ -23,6 +24,7 @@ export async function sendEmail({ template, context, cc, // cc 매개변수 추가 + from, // from 매개변수 추가 attachments = [] }: SendEmailOptions) { try { @@ -47,9 +49,12 @@ export async function sendEmail({ // 템플릿 컴파일 및 HTML 생성 const html = loadTemplate(template, templateData); + // from 값 설정 - 매개변수가 있으면 사용, 없으면 기본값 사용 + const fromAddress = from || `"${process.env.Email_From_Name}" <${process.env.Email_From_Address}>`; + // 이메일 발송 const result = await transporter.sendMail({ - from: `"${process.env.Email_From_Name}" <${process.env.Email_From_Address}>`, + from: fromAddress, to, cc, // cc 필드 추가 subject, @@ -59,7 +64,7 @@ export async function sendEmail({ console.log(`이메일 발송 성공: ${to}`, result.messageId); return result; - + } catch (error) { console.error(`이메일 발송 실패: ${to}`, error); throw error; diff --git a/lib/mail/templates/tech-vendor-invitation.hbs b/lib/mail/templates/tech-vendor-invitation.hbs new file mode 100644 index 00000000..cabd884e --- /dev/null +++ b/lib/mail/templates/tech-vendor-invitation.hbs @@ -0,0 +1,148 @@ + + + + + + eVCP 기술영업 협력업체 등록 초대 + + + + + + \ No newline at end of file diff --git a/lib/mail/templates/vendor-evalution-request.hbs b/lib/mail/templates/vendor-evalution-request.hbs new file mode 100644 index 00000000..7eef3f29 --- /dev/null +++ b/lib/mail/templates/vendor-evalution-request.hbs @@ -0,0 +1,327 @@ + + + + + + 협력업체 평가 자료 요청 | Vendor Evaluation Document Request + + + + + + \ No newline at end of file -- cgit v1.2.3