refactor: update email templates to use dynamic logo URLs and standardize branding to RE-Quest

This commit is contained in:
pradeepkumar
2026-04-09 21:34:04 +05:30
parent 92a29b664c
commit d80f75a39e
5 changed files with 33 additions and 53 deletions

View File

@@ -71,12 +71,12 @@ export class EmailService {
const frontendUrl = this.configService.get<string>('FRONTEND_URL') || 'http://localhost:3000';
const verificationUrl = `${frontendUrl}/verify-email?token=${token}`;
const html = getVerificationEmailTemplate({ verificationUrl, name });
const text = `Welcome to RE-QuestN! Please verify your email by clicking this link: ${verificationUrl}`;
const html = getVerificationEmailTemplate({ verificationUrl, name, frontendUrl });
const text = `Welcome to RE-Quest! Please verify your email by clicking this link: ${verificationUrl}`;
return this.sendEmail({
to: email,
subject: 'Verify Your Email - RE-QuestN',
subject: 'Verify Your Email - RE-Quest',
html,
text,
});
@@ -86,12 +86,13 @@ export class EmailService {
// PASSWORD RESET
// ==========================================
async sendPasswordResetEmail(email: string, resetUrl: string): Promise<boolean> {
const html = getPasswordResetTemplate({ resetUrl });
const frontendUrl = this.configService.get<string>('FRONTEND_URL') || 'http://localhost:3000';
const html = getPasswordResetTemplate({ resetUrl, frontendUrl });
const text = `Reset your password by clicking this link: ${resetUrl}. This link will expire in 1 hour.`;
return this.sendEmail({
to: email,
subject: 'Reset Your Password - RE-QuestN',
subject: 'Reset Your Password - RE-Quest',
html,
text,
});
@@ -103,11 +104,11 @@ export class EmailService {
async sendWelcomeEmail(email: string, name?: string): Promise<boolean> {
const frontendUrl = this.configService.get<string>('FRONTEND_URL') || 'http://localhost:3000';
const html = getWelcomeEmailTemplate({ name, frontendUrl });
const text = `Welcome to RE-QuestN, ${name || 'User'}! Your real estate journey starts now.`;
const text = `Welcome to RE-Quest, ${name || 'User'}! Your real estate journey starts now.`;
return this.sendEmail({
to: email,
subject: 'Welcome to RE-QuestN!',
subject: 'Welcome to RE-Quest!',
html,
text,
});

File diff suppressed because one or more lines are too long

View File

@@ -6,15 +6,17 @@ import { getBaseTemplate } from './base.template';
*/
export interface PasswordResetTemplateData {
resetUrl: string;
frontendUrl?: string;
}
export function getPasswordResetTemplate(data: PasswordResetTemplateData): string {
const { resetUrl } = data;
const { resetUrl, frontendUrl } = data;
const logoUrl = frontendUrl ? `${frontendUrl}/assets/images/splash-logo.png` : undefined;
const content = `
<h1>Reset Your Password</h1>
<p>Hi,</p>
<p>We received a request to reset your password for your RE-QuestN account. Click the button below to create a new password:</p>
<p>We received a request to reset your password for your RE-Quest account. Click the button below to create a new password:</p>
<div class="button-container">
<a href="${resetUrl}" class="button">Reset Password</a>
</div>
@@ -25,5 +27,5 @@ export function getPasswordResetTemplate(data: PasswordResetTemplateData): strin
</div>
`;
return getBaseTemplate(content);
return getBaseTemplate(content, logoUrl);
}

View File

@@ -7,24 +7,26 @@ import { getBaseTemplate } from './base.template';
export interface VerificationTemplateData {
verificationUrl: string;
name?: string;
frontendUrl?: string;
}
export function getVerificationEmailTemplate(data: VerificationTemplateData): string {
const { verificationUrl, name } = data;
const { verificationUrl, name, frontendUrl } = data;
const logoUrl = frontendUrl ? `${frontendUrl}/assets/images/splash-logo.png` : undefined;
const content = `
<h1>Verify Your Email</h1>
<p>Hi ${name || 'there'},</p>
<p>Thank you for signing up for RE-QuestN! To complete your registration and start your real estate journey, please verify your email address by clicking the button below:</p>
<p>Thank you for signing up for RE-Quest! To complete your registration and start your real estate journey, please verify your email address by clicking the button below:</p>
<div class="button-container">
<a href="${verificationUrl}" class="button">Verify Email</a>
</div>
<p>Or copy and paste this link into your browser:</p>
<p style="word-break: break-all; font-size: 14px; color: #5ba4a4;">${verificationUrl}</p>
<div class="note">
<strong>Note:</strong> This verification link will expire in 24 hours. If you didn't create an account with RE-QuestN, please ignore this email.
<strong>Note:</strong> This verification link will expire in 24 hours. If you didn't create an account with RE-Quest, please ignore this email.
</div>
`;
return getBaseTemplate(content);
return getBaseTemplate(content, logoUrl);
}

View File

@@ -11,11 +11,12 @@ export interface WelcomeTemplateData {
export function getWelcomeEmailTemplate(data: WelcomeTemplateData): string {
const { name, frontendUrl } = data;
const logoUrl = frontendUrl ? `${frontendUrl}/assets/images/splash-logo.png` : undefined;
const content = `
<h1>Welcome to RE-QuestN!</h1>
<h1>Welcome to RE-Quest!</h1>
<p>Hi ${name || 'there'},</p>
<p>We're thrilled to have you join RE-QuestN - your trusted real estate platform!</p>
<p>We're thrilled to have you join RE-Quest - your trusted real estate platform!</p>
<p>Here's what you can do:</p>
<ul>
<li>Browse thousands of property listings</li>
@@ -29,5 +30,5 @@ export function getWelcomeEmailTemplate(data: WelcomeTemplateData): string {
<p>If you have any questions, our support team is always here to help!</p>
`;
return getBaseTemplate(content);
return getBaseTemplate(content, logoUrl);
}