blob: 50394c5de7b69db86080f2fad2ede17f91bc7449 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import nodemailer from "nodemailer";
import { emailConfig } from "../utils/email.js";
import type { Project } from "../types.js";
const transporter = nodemailer.createTransport(emailConfig);
export const sendAuditEmail = async (projects: Project[]) => {
const text = emailContent(projects);
const email = await transporter.sendMail({
from: `"${emailConfig.senderName}" <${emailConfig.senderEmail}>`,
to: `${emailConfig.reciever}`,
subject: emailConfig.subject ?? "Dependency Audit!",
text: text,
});
return email;
};
const emailContent = (projects: Project[]): string => {
return `Here is your Report:
${projects.map((project) => {
let projectVulnerabilities = project.metadata.vulnerabilities.total;
return `
${project.projectName} has ${projectVulnerabilities} Security Issues`;
})}
`;
};
|