send fix, send error handling

This commit is contained in:
Timur Ercan
2023-02-09 19:17:34 +01:00
parent 08ec274a22
commit 36df6be703
4 changed files with 28 additions and 13 deletions

View File

@ -2,7 +2,11 @@ import { sendMail } from "./sendMail";
import { NEXT_PUBLIC_WEBAPP_URL } from "@documenso/lib/constants";
import { transactionEmailTemplate } from "@documenso/lib/mail";
export const sendSignedMail = async (recipient: any, document: any) => {
export const sendSignedMail = async (
recipient: any,
document: any,
user: any
) => {
// todo check if recipient has an account
await sendMail(
document.User.email,
@ -14,7 +18,8 @@ export const sendSignedMail = async (recipient: any, document: any) => {
document,
recipient,
`${NEXT_PUBLIC_WEBAPP_URL}/documents/${document.id}`,
`View Document`
`View Document`,
user
)
);
};

View File

@ -18,7 +18,8 @@ export const sendSigningRequest = async (
document,
recipient,
`${NEXT_PUBLIC_WEBAPP_URL}/documents/${document.id}/sign?token=${recipient.token}`,
`Sign Document`
`Sign Document`,
user
)
).catch((err) => {
throw err;

View File

@ -6,7 +6,8 @@ export const transactionEmailTemplate = (
document: any,
recipient: any,
ctaLink: string,
ctaLabel: string
ctaLabel: string,
user: any
) => {
const html = `
<div style="background-color: #eaeaea; padding: 2%;">
@ -20,7 +21,7 @@ export const transactionEmailTemplate = (
</p>
<hr size="1" style="height:1px;border:none;color:#e0e0e0;background-color:#e0e0e0">
Click the button to view "${document.title}".<br>
<small>If you have questions about this document, you should ask ${document.User.name}.</small>
<small>If you have questions about this document, you should ask ${user.name}.</small>
<hr size="1" style="height:1px;border:none;color:#e0e0e0;background-color:#e0e0e0">
</div>
`;