chore(api): improve email templates

This commit is contained in:
isra el
2024-12-01 02:28:39 +03:00
parent e2acbc077d
commit bb2cc320ec
5 changed files with 349 additions and 51 deletions

View File

@@ -3,6 +3,8 @@ MONGO_URI=
JWT_SECRET=secret
JWT_EXPIRATION=60d
FRONTEND_URL=
FIREBASE_PROJECT_ID=
FIREBASE_PRIVATE_KEY_ID=
FIREBASE_PRIVATE_KEY=

View File

@@ -155,11 +155,13 @@ export class AuthService {
})
passwordReset.save()
const resetLink = `${process.env.FRONTEND_URL || 'https://textbee.dev'}/reset-password?email=${encodeURIComponent(user.email)}&otp=${otp}`
await this.mailService.sendEmailFromTemplate({
to: user.email,
subject: 'Password Reset',
subject: 'textbee.dev - Password Reset',
template: 'password-reset-request',
context: { name: user.name, otp },
context: { name: user.name, resetLink, otp },
})
return { message: 'Password reset email sent' }
@@ -189,7 +191,7 @@ export class AuthService {
this.mailService.sendEmailFromTemplate({
to: user.email,
subject: 'Password Reset',
subject: 'textbee.dev - Password Reset',
template: 'password-reset-success',
context: { name: user.name },
})

View File

@@ -1,14 +1,129 @@
<h1>Hello {{name}},</h1>
<p>
We have received a request to reset your password. If you did not make this
request, please ignore this email. Otherwise, you can reset your password
using the OTP below.
</p>
<hr/>
<strong> {{otp}} </strong>
<hr />
<div>
Thank you,
<br />
<i>TextBee.dev</i>
</div>
<html>
<head>
<style>
body {
font-family: Arial, sans-serif;
line-height: 1.6;
color: #333333;
max-width: 600px;
margin: 0 auto;
padding: 20px;
}
.container {
background-color: #ffffff;
border-radius: 8px;
padding: 30px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.header {
text-align: center;
margin-bottom: 30px;
}
.reset-button {
display: inline-block;
background-color: #007bff;
color: white;
padding: 12px 24px;
text-decoration: none;
border-radius: 4px;
margin: 20px 0;
}
.reset-button:hover {
background-color: #0056b3;
}
.divider {
border-top: 1px solid #e0e0e0;
margin: 20px 0;
}
.otp-section {
background-color: #f8f9fa;
padding: 15px;
border-radius: 4px;
text-align: center;
margin: 20px 0;
}
.community-section {
text-align: center;
}
</style>
</head>
<body>
<div class='container'>
<div class='header'>
<h1>Password Reset Request</h1>
</div>
<p>Hello {{name}},</p>
<p>We have received a request to reset your password. If you did not make
this request, please ignore this email. Otherwise, you can reset your
password using the button below.</p>
<div style='text-align: center;'>
<a href='{{resetLink}}' class='reset-button'>Reset Password</a>
</div>
<div class='divider'></div>
<p>If the button above doesn't work, you can copy and paste the following
link into your browser:</p>
<p style='word-break: break-all;'>{{resetLink}}</p>
<div class='otp-section'>
<p>Alternatively, you can use this OTP:</p>
<div class='otp-code'>{{otp}}</div>
</div>
<div class='divider'></div>
<div class='footer'>
<p>
Thank you,<br />
<strong>TextBee.dev</strong>
</p>
<p style='font-size: 12px; color: #999;'>
If you didn't request this password reset, you can safely ignore this
email.
</p>
<div class='divider'></div>
<div class='community-section'>
<p style='font-size: 14px; margin-bottom: 15px;'>Join our community!</p>
<a
href='https://discord.gg/d7vyfBpWbQ'
style='display: inline-block; margin: 0 10px; color: #7289DA; text-decoration: none;'
>
<img
src='https://cdn.prod.website-files.com/6257adef93867e50d84d30e2/636e0a6918e57475a843f59f_icon_clyde_black_RGB.svg'
alt='Discord'
style='width: 20px; vertical-align: middle;'
/>
Join Discord
</a>
<a
href='https://github.com/vernu/textbee'
style='display: inline-block; margin: 0 10px; color: #333; text-decoration: none;'
>
<img
src='https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png'
alt='GitHub'
style='width: 20px; vertical-align: middle;'
/>
Star on GitHub
</a>
<a
href='https://patreon.com/vernu'
style='display: inline-block; margin: 0 10px; color: #FF424D; text-decoration: none;'
>
<img
src='https://c5.patreon.com/external/logo/downloads_logomark_color_on_white.png'
alt='Patreon'
style='width: 20px; vertical-align: middle;'
/>
Support on Patreon
</a>
</div>
</div>
</div>
</body>
</html>

View File

@@ -1,8 +1,92 @@
<h1>Hello {{name}}</h1>
<p>
Your password has been successfully reset. You can now login with your new password.
</p>
<div>
Thank you,
<br />
<i>TextBee.dev</i>
<html>
<head>
<style>
body {
font-family: Arial, sans-serif;
line-height: 1.6;
color: #333333;
max-width: 600px;
margin: 0 auto;
padding: 20px;
}
.container {
background-color: #ffffff;
border-radius: 8px;
padding: 30px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.header {
text-align: center;
margin-bottom: 30px;
}
.divider {
border-top: 1px solid #e0e0e0;
margin: 20px 0;
}
.community-section {
text-align: center;
}
</style>
</head>
<body>
<div class='container'>
<div class='header'>
<h1>Password Reset Successful</h1>
</div>
<p>Hello {{name}},</p>
<p>Your password has been successfully reset. You can now login to your account using your new password.</p>
<div class='divider'></div>
<div class='footer'>
<p>
Thank you,<br />
<strong>TextBee.dev</strong>
</p>
<p style='font-size: 12px; color: #999;'>
If you didn't reset your password, please contact our support team immediately.
</p>
<div class='divider'></div>
<div class='community-section'>
<p style='font-size: 14px; margin-bottom: 15px;'>Join our community!</p>
<a
href='https://discord.gg/d7vyfBpWbQ'
style='display: inline-block; margin: 0 10px; color: #7289DA; text-decoration: none;'
>
<img
src='https://cdn.prod.website-files.com/6257adef93867e50d84d30e2/636e0a6918e57475a843f59f_icon_clyde_black_RGB.svg'
alt='Discord'
style='width: 20px; vertical-align: middle;'
/>
Join Discord
</a>
<a
href='https://github.com/vernu/textbee'
style='display: inline-block; margin: 0 10px; color: #333; text-decoration: none;'
>
<img
src='https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png'
alt='GitHub'
style='width: 20px; vertical-align: middle;'
/>
Star on GitHub
</a>
<a
href='https://patreon.com/vernu'
style='display: inline-block; margin: 0 10px; color: #FF424D; text-decoration: none;'
>
<img
src='https://c5.patreon.com/external/logo/downloads_logomark_color_on_white.png'
alt='Patreon'
style='width: 20px; vertical-align: middle;'
/>
Support on Patreon
</a>
</div>
</div>
</div>
</body>
</html>

View File

@@ -1,32 +1,127 @@
<h1>Hi {{name}},</h1>
<p>
My name is Vernu, and I'm the founder of TextBee.
<br /><br />
<html>
<head>
<style>
body {
font-family: Arial, sans-serif;
line-height: 1.6;
color: #333333;
max-width: 600px;
margin: 0 auto;
padding: 20px;
}
.container {
background-color: #ffffff;
border-radius: 8px;
padding: 30px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.header {
text-align: center;
margin-bottom: 30px;
}
.divider {
border-top: 1px solid #e0e0e0;
margin: 20px 0;
}
.community-section {
text-align: center;
}
.tips-section {
margin: 20px 0;
}
.tips-section ol {
padding-left: 20px;
}
.signature {
margin-top: 20px;
}
</style>
</head>
<body>
<div class='container'>
<div class='header'>
<h1>Welcome to TextBee!</h1>
</div>
I built TextBee to help you with your messaging needs. be it sending OTP, notifications, or automated messaging workflows for your business.
<br/><br/>
<p>Hi {{name}},</p>
Here are few tips to get you started: <br/><br />
<p>I'm Vernu, the founder of TextBee. I built this platform to help you
with all your messaging needs - whether it's sending OTPs,
notifications, or creating automated messaging workflows for your
business.</p>
<ol start="1">
<li><a href="https://github.com/vernu/textbee">Explore our Documentation: Learn how to integrate TextBee with your existing systems in the github readme</a></li>
<li><a href="https://discord.gg/d7vyfBpWbQ">Join the Community on Discord and get help: Connect with other users and developers, ask questions, and share ideas on our Community Forum.</a></li>
<li><a href="https://www.patreon.com/vernu">Support Our Work: Consider supporting us on Patreon to help us continue improving TextBee.</a></li>
<li><a href="https://github.com/vernu/textbee">Star our repo on Github</a></li>
<br /> <br/>
<hr/>
<div class='tips-section'>
<h3>Here are a few tips to get you started:</h3>
<ol>
<li><a href='https://github.com/vernu/textbee'>Explore our
Documentation</a>
- Learn how to integrate TextBee with your existing systems</li>
<li><a href='https://dl.textbee.dev'>Download the Mobile App</a></li>
<li><a href='https://textbee.dev/dashboard'>Access your Dashboard</a></li>
<li><a href='https://discord.gg/d7vyfBpWbQ'>Join our Discord Community</a></li>
<li><a href='https://www.patreon.com/vernu'>Support Our Work</a></li>
<li><a href='https://github.com/vernu/textbee'>Star our GitHub
Repository</a></li>
</ol>
</div>
P.S. Why did you choose TextBee? What feedback do you have? <br/>
Do you have any questions or need assistance? <br/>
Feel free to reach out to our support team at <a href="mailto:contact@textbee.dev">contact@textbee.dev</a>. <br/>
we read and respond to all emails as quickly as possible.
</p>
<hr/>
<div>
Cheers, <br />
Vernu, founder <br />
<br />
<i>TextBee.dev</i>
</div>
<div class='divider'></div>
<p>
<strong>P.S.</strong>
I'd love to hear from you! Why did you choose TextBee? Do you have any
feedback or questions?<br />
Feel free to reach out to our support team at
<a href='mailto:contact@textbee.dev'>contact@textbee.dev</a>.<br />
We read and respond to all emails as quickly as possible.
</p>
<div class='signature'>
<p>
Cheers,<br />
<strong>Vernu</strong><br />
Founder, TextBee.dev
</p>
</div>
<div class='divider'></div>
<div class='community-section'>
<p style='font-size: 14px; margin-bottom: 15px;'>Join our community!</p>
<a
href='https://discord.gg/d7vyfBpWbQ'
style='display: inline-block; margin: 0 10px; color: #7289DA; text-decoration: none;'
>
<img
src='https://cdn.prod.website-files.com/6257adef93867e50d84d30e2/636e0a6918e57475a843f59f_icon_clyde_black_RGB.svg'
alt='Discord'
style='width: 20px; vertical-align: middle;'
/>
Join Discord
</a>
<a
href='https://github.com/vernu/textbee'
style='display: inline-block; margin: 0 10px; color: #333; text-decoration: none;'
>
<img
src='https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png'
alt='GitHub'
style='width: 20px; vertical-align: middle;'
/>
Star on GitHub
</a>
<a
href='https://patreon.com/vernu'
style='display: inline-block; margin: 0 10px; color: #FF424D; text-decoration: none;'
>
<img
src='https://c5.patreon.com/external/logo/downloads_logomark_color_on_white.png'
alt='Patreon'
style='width: 20px; vertical-align: middle;'
/>
Support on Patreon
</a>
</div>
</div>
</body>
</html>