-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add updates page This page is used when the email is sent which contains updates to an event created/attended by user * feat: add validation for email body * fix: updatesText for update.html * fix: remove name and add event for the email, change type of bcc to list[email] * Add RSVP invite email functionality and template Introduced a new RSVP invite functionality by adding support for a new template in `app/config.py` and `app/schemas/email.py`. A dedicated HTML template `rsvp/invite.html` was created for rendering invite emails with required placeholders, and validation logic was updated to ensure required fields are present for invites. * Revert "Add RSVP invite email functionality and template" This reverts commit 6324f10. * Reapply "Add RSVP invite email functionality and template" This reverts commit fc0e741. * fix: remove .idea files
- Loading branch information
1 parent
79711fb
commit abdcd97
Showing
6 changed files
with
305 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,52 @@ | ||
""" | ||
For environment validation and constants | ||
""" | ||
|
||
import os | ||
from typing import cast, List | ||
from pydantic_settings import BaseSettings | ||
|
||
|
||
SWAGGER_APP_DESCRIPTION = """ | ||
The EmailService is a lightweight application dedicated to sending | ||
emails to recipients associated with Teamshiksha projects. | ||
This service will be utilized by most projects, | ||
so all email templates should be centralized within it, | ||
along with maintaining updated mappings for unique template IDs. | ||
How to use it ? | ||
1. Add your template in `templates` folder based on your project. | ||
2. Update the template and ID map given in `config` file. | ||
3. Add validation in the `SendEmailRequestBody` class inside `schemas/email` file. | ||
Code available `https://github.com/TeamShiksha/email-service` | ||
""" | ||
|
||
TEMPLATE_HASH_MAP = { | ||
1: "openlogo/ForgotPassword.html", | ||
2: "openlogo/Verify.html", | ||
3: "openlogo/Respond.html", | ||
4: "rsvp/Verify.html", | ||
5: "rsvp/ticket.html", | ||
6: "rsvp/update.html" | ||
} | ||
|
||
|
||
class Config(BaseSettings): | ||
""" | ||
Environmental variable validation class. | ||
""" | ||
|
||
EMAIL_PORT: int = cast(int, os.getenv("EMAIL_PORT", "587")) | ||
EMAIL_HOST: str = cast(str, os.getenv("EMAIL_HOST", "smtp.gmail.com")) | ||
EMAIL_ADDRESS: str = cast(str, os.getenv("EMAIL_ADDRESS")) | ||
EMAIL_PASSWORD: str = cast(str, os.getenv("EMAIL_PASSWORD")) | ||
APP_SECRET: str = cast(str, os.getenv("APP_SECRET")) | ||
ENV: str = cast(str, os.getenv("ENV", "development")) | ||
ORIGINS: List[str] = ["https://logoexecutive.vercel.app", "https://openlogo.fyi", | ||
"http://rsvp.kim", "http://localhost:8000", "http://localhost:5000"] | ||
DESCRIPTION: str = SWAGGER_APP_DESCRIPTION | ||
|
||
|
||
config = Config() | ||
""" | ||
For environment validation and constants | ||
""" | ||
|
||
import os | ||
from typing import cast, List | ||
from pydantic_settings import BaseSettings | ||
|
||
|
||
SWAGGER_APP_DESCRIPTION = """ | ||
The EmailService is a lightweight application dedicated to sending | ||
emails to recipients associated with Teamshiksha projects. | ||
This service will be utilized by most projects, | ||
so all email templates should be centralized within it, | ||
along with maintaining updated mappings for unique template IDs. | ||
How to use it ? | ||
1. Add your template in `templates` folder based on your project. | ||
2. Update the template and ID map given in `config` file. | ||
3. Add validation in the `SendEmailRequestBody` class inside `schemas/email` file. | ||
Code available `https://github.com/TeamShiksha/email-service` | ||
""" | ||
|
||
TEMPLATE_HASH_MAP = { | ||
1: "openlogo/ForgotPassword.html", | ||
2: "openlogo/Verify.html", | ||
3: "openlogo/Respond.html", | ||
4: "rsvp/Verify.html", | ||
5: "rsvp/ticket.html", | ||
6: "rsvp/update.html", | ||
7: "rsvp/invite.html" | ||
} | ||
|
||
|
||
class Config(BaseSettings): | ||
""" | ||
Environmental variable validation class. | ||
""" | ||
|
||
EMAIL_PORT: int = cast(int, os.getenv("EMAIL_PORT", "587")) | ||
EMAIL_HOST: str = cast(str, os.getenv("EMAIL_HOST", "smtp.gmail.com")) | ||
EMAIL_ADDRESS: str = cast(str, os.getenv("EMAIL_ADDRESS")) | ||
EMAIL_PASSWORD: str = cast(str, os.getenv("EMAIL_PASSWORD")) | ||
APP_SECRET: str = cast(str, os.getenv("APP_SECRET")) | ||
ENV: str = cast(str, os.getenv("ENV", "development")) | ||
ORIGINS: List[str] = ["https://logoexecutive.vercel.app", "https://openlogo.fyi", "http://rsvp.kim"] | ||
DESCRIPTION: str = SWAGGER_APP_DESCRIPTION | ||
|
||
|
||
config = Config() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,238 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html dir="ltr" lang="en"> | ||
<head> | ||
<link rel="preload" as="image" href="cid:logo.png" /> | ||
<link rel="preload" as="image" href="cid:verification-email.png" /> | ||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /> | ||
<meta name="x-apple-disable-message-reformatting" /> | ||
<style> | ||
@font-face { | ||
font-family: "Inter"; | ||
font-style: normal; | ||
font-weight: 400; | ||
mso-font-alt: "Verdana"; | ||
} | ||
|
||
* { | ||
font-family: "Inter", Verdana; | ||
} | ||
|
||
body { | ||
background: #141415; | ||
padding-top: 2.5rem; | ||
padding-bottom: 2.5rem; | ||
} | ||
|
||
.container { | ||
max-width: 37.5em; | ||
margin: 0 auto; | ||
padding-left: 1.5rem; | ||
padding-right: 1.5rem; | ||
} | ||
|
||
.logo, | ||
.verification-image { | ||
display: block; | ||
outline: none; | ||
border: none; | ||
text-decoration: none; | ||
} | ||
|
||
.verification-image { | ||
height: auto; | ||
width: 100%; | ||
} | ||
|
||
.heading { | ||
font-size: 2.25rem; | ||
line-height: 2.5rem; | ||
margin: 16px 0; | ||
margin-top: 2.75rem; | ||
font-weight: 600; | ||
color: rgb(255, 255, 255); | ||
} | ||
|
||
.text { | ||
font-size: 1.125rem; | ||
line-height: 1.75rem; | ||
margin: 16px 0; | ||
margin-top: 1.5rem; | ||
color: rgb(255, 255, 255); | ||
} | ||
|
||
.button { | ||
background-color: #ac6aff; | ||
font-size: 16px; | ||
padding: 10px 20px; | ||
width: 100%; | ||
text-align: center; | ||
border-radius: 20px; | ||
margin-left: 0; | ||
} | ||
|
||
.button-block { | ||
background-color: #ac6aff; | ||
width: 100%; | ||
font-size: 16px; | ||
padding: 10px 20px; | ||
text-align: center; | ||
margin-left: 0; | ||
} | ||
|
||
.text-box { | ||
background-color: black; | ||
color: white; | ||
padding: 16px; | ||
} | ||
|
||
.button a { | ||
color: white; | ||
text-decoration: none; | ||
font-size: 14px; | ||
} | ||
|
||
.button-block span { | ||
color: white; | ||
text-decoration: none; | ||
font-size: 14px; | ||
} | ||
|
||
.footer-text { | ||
font-size: 0.875rem; | ||
line-height: 1.25rem; | ||
margin: 16px 0; | ||
color: rgb(255, 255, 255); | ||
} | ||
|
||
.footer-text a { | ||
color: #ac6aff; | ||
text-decoration: none; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<table | ||
align="center" | ||
width="100%" | ||
border="0" | ||
cellpadding="0" | ||
cellspacing="0" | ||
role="presentation" | ||
class="container" | ||
> | ||
<tbody> | ||
<tr> | ||
<td> | ||
<table | ||
align="center" | ||
width="100%" | ||
border="0" | ||
cellpadding="0" | ||
cellspacing="0" | ||
role="presentation" | ||
> | ||
<tbody> | ||
<tr> | ||
<td> | ||
<img | ||
alt="Team shiksha logo" | ||
src="https://raw.githubusercontent.com/TeamShiksha/email-service/refs/heads/main/images/logo.png" | ||
class="logo" | ||
width="100" | ||
height="50" | ||
/> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<table | ||
align="center" | ||
width="100%" | ||
border="0" | ||
cellpadding="0" | ||
cellspacing="0" | ||
role="presentation" | ||
> | ||
<tbody> | ||
<tr> | ||
<td> | ||
<img | ||
src="https://raw.githubusercontent.com/TeamShiksha/email-service/refs/heads/main/images/verification-img.png" | ||
class="verification-image" | ||
/> | ||
<p class="text"> | ||
{{inviteeName}} invited you to an event: | ||
{{eventName}}, | ||
</p> | ||
<table | ||
align="center" | ||
width="100%" | ||
border="0" | ||
cellpadding="0" | ||
cellspacing="0" | ||
role="presentation" | ||
class="button-block" | ||
> | ||
<tbody> | ||
<tr> | ||
<td> | ||
<span>Your invite update...</span> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<p class="text-box">{{inviteText}}.</p> | ||
<table | ||
align="center" | ||
width="100%" | ||
border="0" | ||
cellpadding="0" | ||
cellspacing="0" | ||
role="presentation" | ||
class="button" | ||
> | ||
<tbody> | ||
<tr> | ||
<td> | ||
<a href="{{inviteLink}}" target="_blank" | ||
>Register for the event</a | ||
> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<p class="text"> | ||
We appreciate your understanding and cooperation with this | ||
adjustment. Should you have any questions or require any | ||
information. | ||
</p> | ||
<p class="text">Happy Unforgettable events!</p> | ||
<p class="text">RSVP.KIM</p> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<table | ||
align="center" | ||
width="100%" | ||
border="0" | ||
cellpadding="0" | ||
cellspacing="0" | ||
role="presentation" | ||
> | ||
<tbody> | ||
<tr> | ||
<td> | ||
<p class="footer-text"> | ||
© 2025 <a href="https://rsvp.kim" target="_blank">RSVP.KIM</a>. All rights reserved. Powered by <a href="https://team.shiksha/" target="_blank">Team Shiksha</a> | ||
</p> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.