2023-01-26 16:20:48 +01:00
|
|
|
import { sendMail } from "./sendMail";
|
|
|
|
|
import { NEXT_PUBLIC_WEBAPP_URL } from "@documenso/lib/constants";
|
2023-02-21 17:42:30 +01:00
|
|
|
import { signingCompleteTemplate } from "@documenso/lib/mail";
|
2023-03-01 14:58:31 +01:00
|
|
|
import { Document as PrismaDocument } from "@prisma/client";
|
2023-01-26 16:20:48 +01:00
|
|
|
|
2023-02-21 16:15:36 +01:00
|
|
|
export const sendSigningDoneMail = async (
|
2023-02-09 19:17:34 +01:00
|
|
|
recipient: any,
|
2023-03-01 14:58:31 +01:00
|
|
|
document: PrismaDocument,
|
2023-02-09 19:17:34 +01:00
|
|
|
user: any
|
|
|
|
|
) => {
|
2023-01-27 18:15:41 +01:00
|
|
|
await sendMail(
|
2023-02-21 16:30:29 +01:00
|
|
|
user.email,
|
|
|
|
|
`Completed: "${document.title}"`,
|
2023-02-21 17:42:30 +01:00
|
|
|
// base template with footer and box vs content template for eact type
|
|
|
|
|
signingCompleteTemplate(`All recipients have signed "${document.title}".`),
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
filename: document.title,
|
|
|
|
|
content: Buffer.from(document.document.toString(), "base64"),
|
|
|
|
|
},
|
|
|
|
|
]
|
2023-01-26 16:20:48 +01:00
|
|
|
);
|
|
|
|
|
};
|