feat: send custom email message

This commit is contained in:
Ephraim Atta-Duncan
2023-09-20 09:59:42 +00:00
committed by Mythie
parent a3baf2ed8b
commit da16f1ee07
2 changed files with 8 additions and 2 deletions

View File

@ -20,7 +20,9 @@ import {
} from '../template-components/template-document-invite'; } from '../template-components/template-document-invite';
import TemplateFooter from '../template-components/template-footer'; import TemplateFooter from '../template-components/template-footer';
export type DocumentInviteEmailTemplateProps = Partial<TemplateDocumentInviteProps>; export type DocumentInviteEmailTemplateProps = Partial<TemplateDocumentInviteProps> & {
customBody?: string;
};
export const DocumentInviteEmailTemplate = ({ export const DocumentInviteEmailTemplate = ({
inviterName = 'Lucas Smith', inviterName = 'Lucas Smith',
@ -28,6 +30,7 @@ export const DocumentInviteEmailTemplate = ({
documentName = 'Open Source Pledge.pdf', documentName = 'Open Source Pledge.pdf',
signDocumentLink = 'https://documenso.com', signDocumentLink = 'https://documenso.com',
assetBaseUrl = 'http://localhost:3002', assetBaseUrl = 'http://localhost:3002',
customBody,
}: DocumentInviteEmailTemplateProps) => { }: DocumentInviteEmailTemplateProps) => {
const previewText = `Completed Document`; const previewText = `Completed Document`;
@ -78,7 +81,9 @@ export const DocumentInviteEmailTemplate = ({
</Text> </Text>
<Text className="mt-2 text-base text-slate-400"> <Text className="mt-2 text-base text-slate-400">
{inviterName} has invited you to sign the document "{documentName}". {customBody
? customBody
: `${inviterName} has invited you to sign the document "${documentName}".`}
</Text> </Text>
</Section> </Section>
</Container> </Container>

View File

@ -60,6 +60,7 @@ export const sendDocument = async ({ documentId, userId }: SendDocumentOptions)
inviterEmail: user.email, inviterEmail: user.email,
assetBaseUrl, assetBaseUrl,
signDocumentLink, signDocumentLink,
customBody: customEmail?.customEmailBody || '',
}); });
await mailer.sendMail({ await mailer.sendMail({