feat: implement invitation email functionality for organization creation

- Added `sendInvitationEmail` function to send invitation emails when a new organization is created in the cloud environment.
- Updated email template to enhance the invitation message and included a direct link for users to accept the invitation.
- Refactored email sending logic in the user router to utilize the new invitation email rendering function.
- Improved organization invitation email design for better user experience.
This commit is contained in:
Mauricio Siu
2026-04-24 21:40:08 -06:00
parent cdd77a04dc
commit b610f7aeff
6 changed files with 132 additions and 80 deletions

View File

@@ -1,4 +1,5 @@
import { renderAsync } from "@react-email/components";
import InvitationEmail from "../emails/emails/invitation";
import VerifyEmailTemplate from "../emails/emails/verify-email";
import { sendEmailNotification } from "../utils/notifications/utils";
@@ -51,3 +52,38 @@ export const sendVerificationEmail = async ({
text: html,
});
};
export const renderInvitationEmail = async ({
email,
inviteLink,
organizationName,
}: {
email: string;
inviteLink: string;
organizationName: string;
}) => {
return renderAsync(
InvitationEmail({
inviteLink,
toEmail: email,
organizationName,
}),
);
};
export const sendInvitationEmail = async ({
email,
inviteLink,
organizationName,
}: {
email: string;
inviteLink: string;
organizationName: string;
}) => {
const html = await renderInvitationEmail({ email, inviteLink, organizationName });
await sendEmail({
email,
subject: `You've been invited to join ${organizationName} on Dokploy`,
text: html,
});
};