diff options
Diffstat (limited to 'lib/mail')
| -rw-r--r-- | lib/mail/sendEmail.ts | 9 | ||||
| -rw-r--r-- | lib/mail/templates/tech-vendor-invitation.hbs | 148 | ||||
| -rw-r--r-- | lib/mail/templates/vendor-evalution-request.hbs | 327 |
3 files changed, 482 insertions, 2 deletions
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<string, any>; // 템플릿에 주입할 데이터 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 @@ +<!DOCTYPE html>
+<html lang="ko">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>eVCP 기술영업 협력업체 등록 초대</title>
+ <style>
+ body {
+ margin: 0 !important;
+ padding: 20px !important;
+ background-color: #f4f4f4;
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
+ line-height: 1.6;
+ }
+ .email-container {
+ max-width: 600px;
+ margin: 0 auto;
+ background-color: #ffffff;
+ padding: 30px;
+ border-radius: 10px;
+ box-shadow: 0 4px 15px rgba(0,0,0,0.1);
+ }
+ .header {
+ border-bottom: 3px solid #163CC4;
+ padding-bottom: 20px;
+ margin-bottom: 30px;
+ }
+ .logo {
+ color: #163CC4;
+ font-weight: bold;
+ font-size: 36px;
+ margin: 0;
+ }
+ .title {
+ color: #1f2937;
+ font-size: 28px;
+ font-weight: 600;
+ margin: 0 0 20px 0;
+ }
+ .content {
+ color: #374151;
+ font-size: 16px;
+ line-height: 1.7;
+ margin-bottom: 16px;
+ }
+ .highlight-box {
+ background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
+ border-left: 4px solid #163CC4;
+ border-radius: 8px;
+ padding: 20px;
+ margin: 25px 0;
+ }
+ .cta-button {
+ display: inline-block;
+ background: linear-gradient(135deg, #163CC4 0%, #1e40af 100%);
+ color: #ffffff !important;
+ text-decoration: none;
+ padding: 15px 35px;
+ border-radius: 8px;
+ font-weight: 600;
+ font-size: 16px;
+ text-align: center;
+ transition: all 0.3s ease;
+ box-shadow: 0 4px 12px rgba(22, 60, 196, 0.3);
+ }
+ .footer {
+ border-top: 1px solid #e5e7eb;
+ padding-top: 20px;
+ margin-top: 40px;
+ text-align: center;
+ }
+ .footer-text {
+ color: #6b7280;
+ font-size: 14px;
+ margin: 8px 0;
+ }
+ </style>
+</head>
+<body>
+ <div class="email-container">
+ <div class="header">
+ <h1 class="logo">eVCP</h1>
+ </div>
+
+ <h1 class="title">기술영업 협력업체 등록 초대</h1>
+
+ <p class="content">
+ <strong>{{companyName}}</strong> 귀하,
+ </p>
+
+ <p class="content">
+ 안녕하세요. 삼성중공업 eVCP 시스템입니다.
+ </p>
+
+ <p class="content">
+ 귀사를 저희 <strong>eVCP 기술영업 협력업체</strong>로 등록하도록 정중히 초대합니다.
+ 기술영업 협력업체로 등록하시면 다음과 같은 혜택을 누리실 수 있습니다:
+ </p>
+
+ <div class="highlight-box">
+ <ul style="margin: 0; padding-left: 20px; color: #374151;">
+ <li style="margin-bottom: 8px;">기술 제안서(RFQ) 참여 기회</li>
+ <li style="margin-bottom: 8px;">기술 검토 및 평가 프로세스 참여</li>
+ <li style="margin-bottom: 8px;">조선/해양 프로젝트 기술영업 참여</li>
+ <li style="margin-bottom: 8px;">온라인 플랫폼을 통한 효율적인 업무 처리</li>
+ </ul>
+ </div>
+
+ <p class="content">
+ 아래 버튼을 클릭하여 기술영업 협력업체 등록을 완료해 주세요.
+ 등록 포털에서 귀사의 기본 정보, 기술 역량, 연락처 등을 입력하실 수 있습니다.
+ </p>
+
+ <p style="text-align: center; margin: 30px 0;">
+ <a href="{{registrationLink}}" target="_blank" class="cta-button">
+ 📝 기술영업 협력업체 등록하기
+ </a>
+ </p>
+
+ <div style="background-color: #fef3c7; border: 1px solid #f59e0b; border-radius: 6px; padding: 15px; margin: 25px 0;">
+ <p style="margin: 0; color: #92400e; font-size: 14px;">
+ ⚠️ <strong>중요:</strong> 이 초대 링크는 <strong>7일 후</strong>에 만료됩니다.
+ 가능한 빠른 시일 내에 등록을 완료해 주세요.
+ </p>
+ </div>
+
+ <p class="content">
+ 등록 과정에서 문제가 발생하거나 궁금한 사항이 있으시면,
+ 언제든지 <strong>support@evcp.com</strong>으로 연락 주시기 바랍니다.
+ </p>
+
+ <p class="content">
+ 귀사와 함께 성공적인 파트너십을 구축하고,
+ 저희 기술영업 협력업체 네트워크의 소중한 일원이 되어 주시기를 기대합니다.
+ </p>
+
+ <p class="content" style="margin-top: 30px;">
+ 감사합니다.<br>
+ <strong>삼성중공업 eVCP 기술영업팀</strong>
+ </p>
+
+ <div class="footer">
+ <p class="footer-text">© 2024 Samsung Heavy Industries eVCP. All rights reserved.</p>
+ <p class="footer-text">이 메일은 자동으로 발송된 메일입니다. 회신하지 마시기 바랍니다.</p>
+ </div>
+ </div>
+</body>
+</html>
\ 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 @@ +<!DOCTYPE html> +<html lang="ko"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>협력업체 평가 자료 요청 | Vendor Evaluation Document Request</title> + <style> + body { + font-family: 'Apple SD Gothic Neo', 'Malgun Gothic', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + line-height: 1.6; + color: #333; + max-width: 650px; + margin: 0 auto; + padding: 20px; + background-color: #f8f9fa; + } + .email-container { + background: white; + border-radius: 12px; + box-shadow: 0 4px 20px rgba(0,0,0,0.08); + overflow: hidden; + } + .header { + background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%); + color: white; + padding: 30px; + text-align: center; + } + .logo { + font-size: 28px; + font-weight: 700; + margin-bottom: 8px; + letter-spacing: 1px; + } + .header-title { + font-size: 18px; + opacity: 0.95; + margin: 0; + } + .content { + padding: 35px; + } + .greeting { + font-size: 16px; + margin-bottom: 25px; + color: #374151; + } + .section { + margin-bottom: 30px; + } + .section-title { + font-size: 18px; + font-weight: 600; + color: #1f2937; + margin-bottom: 15px; + border-bottom: 2px solid #e5e7eb; + padding-bottom: 8px; + } + .info-grid { + background-color: #f9fafb; + border-radius: 8px; + padding: 20px; + border-left: 4px solid #3b82f6; + } + .info-row { + display: flex; + margin-bottom: 12px; + align-items: center; + } + .info-label { + font-weight: 600; + min-width: 140px; + color: #6b7280; + font-size: 14px; + } + .info-value { + color: #111827; + font-weight: 500; + } + .due-date { + color: #dc2626; + font-weight: 700; + background-color: #fef2f2; + padding: 2px 8px; + border-radius: 4px; + } + .message-box { + background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); + border-radius: 8px; + padding: 20px; + margin: 20px 0; + border: 1px solid #f59e0b; + } + .message-title { + font-weight: 600; + color: #92400e; + margin-bottom: 10px; + font-size: 16px; + } + .message-content { + color: #78350f; + white-space: pre-line; + line-height: 1.5; + } + .action-section { + text-align: center; + background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); + border-radius: 8px; + padding: 25px; + margin: 25px 0; + } + .action-title { + font-size: 18px; + font-weight: 600; + color: #1e40af; + margin-bottom: 10px; + } + .action-description { + color: #1e40af; + margin-bottom: 20px; + line-height: 1.5; + } + .cta-button { + display: inline-block; + background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%); + color: white; + padding: 14px 30px; + text-decoration: none; + border-radius: 8px; + font-weight: 600; + font-size: 16px; + box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3); + transition: all 0.3s ease; + } + .cta-button:hover { + transform: translateY(-2px); + box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4); + } + .important-notes { + background-color: #fef2f2; + border: 1px solid #fecaca; + border-radius: 8px; + padding: 20px; + margin: 25px 0; + } + .important-title { + font-weight: 600; + color: #dc2626; + margin-bottom: 12px; + font-size: 16px; + } + .note-item { + color: #7f1d1d; + margin-bottom: 8px; + padding-left: 20px; + position: relative; + } + .note-item::before { + content: "•"; + color: #dc2626; + font-weight: 600; + position: absolute; + left: 0; + } + .contact-section { + background-color: #f8fafc; + border-radius: 8px; + padding: 20px; + margin: 25px 0; + border: 1px solid #e2e8f0; + } + .contact-title { + font-weight: 600; + color: #334155; + margin-bottom: 15px; + font-size: 16px; + } + .contact-info { + color: #475569; + line-height: 1.6; + } + .contact-email { + color: #3b82f6; + text-decoration: none; + font-weight: 500; + } + .footer { + background-color: #f1f5f9; + padding: 25px; + text-align: center; + color: #64748b; + font-size: 14px; + border-top: 1px solid #e2e8f0; + } + .footer-text { + margin-bottom: 8px; + } + .disclaimer { + font-size: 12px; + color: #94a3b8; + } + .bilingual { + margin-bottom: 4px; + } + .english { + color: #6b7280; + font-size: 14px; + } + </style> +</head> +<body> + <div class="email-container"> + <div class="header"> + <div class="logo">Oracle Corporation</div> + <h1 class="header-title"> + 협력업체 평가 자료 요청<br> + <span class="english">Vendor Evaluation Document Request</span> + </h1> + </div> + + <div class="content"> + <div class="greeting"> + <div class="bilingual">안녕하세요, <strong>{{companyName}}</strong> 담당자님</div> + <div class="english">Dear <strong>{{companyName}}</strong> Representative,</div> + </div> + + <div class="section"> + <h2 class="section-title"> + 평가 정보 | Evaluation Information + </h2> + <div class="info-grid"> + <div class="info-row"> + <span class="info-label">평가 연도 | Year:</span> + <span class="info-value">{{evaluationYear}}</span> + </div> + {{#if evaluationRound}} + <div class="info-row"> + <span class="info-label">평가 차수 | Round:</span> + <span class="info-value">{{evaluationRound}}</span> + </div> + {{/if}} + <div class="info-row"> + <span class="info-label">요청일 | Request Date:</span> + <span class="info-value">{{requestDate}}</span> + </div> + {{#if dueDate}} + <div class="info-row"> + <span class="info-label">제출 마감일 | Due Date:</span> + <span class="info-value due-date">{{dueDate}}</span> + </div> + {{/if}} + </div> + </div> + + {{#if reviewComments}} + <div class="section"> + <div class="message-box"> + <div class="message-title"> + 추가 안내사항 | Additional Message + </div> + <div class="message-content">{{reviewComments}}</div> + </div> + </div> + {{/if}} + + <div class="section"> + <div class="action-section"> + <h3 class="action-title"> + 필요한 조치 | Action Required + </h3> + <p class="action-description"> + 아래 버튼을 클릭하여 협력업체 포털에 접속하시고, 요청된 평가 자료를 제출해 주시기 바랍니다.<br> + <span class="english">Please click the button below to access the vendor portal and submit the requested evaluation documents.</span> + </p> + <a href="{{accessUrl}}" class="cta-button"> + 협력업체 포털 접속 | Access Vendor Portal + </a> + </div> + </div> + + <div class="section"> + <div class="important-notes"> + <div class="important-title"> + 중요 안내 | Important Notice + </div> + <div class="note-item"> + 반드시 마감일까지 모든 자료를 제출해 주세요<br> + <span class="english">Please ensure all documents are submitted by the deadline</span> + </div> + <div class="note-item"> + 모든 평가 항목을 빠짐없이 작성해 주세요<br> + <span class="english">Please complete all evaluation sections thoroughly</span> + </div> + <div class="note-item"> + 문의사항이 있으시면 아래 연락처로 연락해 주세요<br> + <span class="english">If you have any questions, please contact us using the information below</span> + </div> + </div> + </div> + + <div class="section"> + <div class="contact-section"> + <h4 class="contact-title"> + 문의 연락처 | Contact Information + </h4> + <div class="contact-info"> + <strong>담당자 | Manager:</strong> {{managerName}}<br> + <strong>이메일 | Email:</strong> <a href="mailto:{{supportEmail}}" class="contact-email">{{supportEmail}}</a><br> + <strong>업무시간 | Business Hours:</strong> {{businessHours}} + </div> + </div> + </div> + </div> + + <div class="footer"> + <div class="footer-text"> + 본 메일은 Oracle Corporation 협력업체 평가 시스템에서 자동 발송되었습니다.<br> + <span class="english">This email was automatically sent from the Oracle Corporation Vendor Evaluation System.</span> + </div> + <div class="disclaimer"> + 본 메일에 회신하지 마시고, 문의사항은 위의 연락처를 이용해 주세요.<br> + Please do not reply to this email. For inquiries, please use the contact information above. + </div> + </div> + </div> +</body> +</html>
\ No newline at end of file |
