Skip to content

Commit

Permalink
Merge pull request #168 from daviduzondu/chore/add-email-templates
Browse files Browse the repository at this point in the history
Chore/add email templates
  • Loading branch information
Idimmusix authored Jul 23, 2024
2 parents bd6f9a0 + 251cb3a commit d38a661
Show file tree
Hide file tree
Showing 16 changed files with 2,062 additions and 617 deletions.
330 changes: 330 additions & 0 deletions docs/email.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,330 @@
# Email Template Documentation

## Password Reset Template Structure

This email template is designed for password reset notifications.

### Required Variables

- `{{title}}`
**Description:** The title of the email.
**Type:** String

- `{{logoUrl}}`
**Description:** URL of the logo image.
**Type:** String

- `{{imageUrl}}`
**Description:** URL of the main image displayed in the email.
**Type:** String

- `{{userName}}`
**Description:** Name of the recipient.
**Type:** String

- `{{resetUrl}}`
**Description:** URL for the password reset action.
**Type:** String

- `{{companyName}}`
**Description:** Name of the company sending the email.
**Type:** String

- `{{supportUrl}}`
**Description:** URL to contact customer support.
**Type:** String

- `{{socialIcons}}`
**Description:** Array of social media icons with URLs and image sources.
**Type:** Array of Objects
**Object Properties:**

- `url` **String:** URL for the social media profile.
- `imgSrc` **String:** URL of the social media icon image.
- `alt` **String:** Alt text for the social media icon.

- `{{companyWebsite}}`
**Description:** URL of the company's website.
**Type:** String

- `{{preferencesUrl}}`
**Description:** URL for updating email preferences.
**Type:** String

- `{{unsubscribeUrl}}`
**Description:** URL for unsubscribing from the email list.
**Type:** String

## Successful Password Reset Template Structure

This email template is used for notifying users about a successful password change.

### Required Variables

- `{{title}}`
**Description:** The title of the email.
**Type:** String

- `{{logoUrl}}`
**Description:** URL of the logo image.
**Type:** String

- `{{imageUrl}}`
**Description:** URL of the main image displayed in the email.
**Type:** String

- `{{userName}}`
**Description:** Name of the recipient.
**Type:** String

- `{{accountRecoverUrl}}`
**Description:** URL for recovering the account.
**Type:** String

- `{{companyName}}`
**Description:** Name of the company sending the email.
**Type:** String

- `{{socialIcons}}`
**Description:** Array of social media icons with URLs and image sources.
**Type:** Array of Objects
**Object Properties:**

- `url` **String:** URL for the social media profile.
- `imgSrc` **String:** URL of the social media icon image.
- `alt` **String:** Alt text for the social media icon.

- `{{supportUrl}}`
**Description:** URL to contact customer support.
**Type:** String

- `{{companyWebsite}}`
**Description:** URL of the company's website.
**Type:** String

- `{{preferencesUrl}}`
**Description:** URL for updating email preferences.
**Type:** String

- `{{unsubscribeUrl}}`
**Description:** URL for unsubscribing from the email list.
**Type:** String

## New Activation Link Sent Template Structure

This email template is used for sending activation links to users.

### Required Variables

- `{{title}}`
**Description:** The title of the email.
**Type:** String

- `{{logoUrl}}`
**Description:** URL of the logo image.
**Type:** String

- `{{imageUrl}}`
**Description:** URL of the main image displayed in the email.
**Type:** String

- `{{userName}}`
**Description:** Name of the recipient.
**Type:** String

- `{{activationLinkUrl}}`
**Description:** URL for activating the user's account.
**Type:** String

- `{{companyName}}`
**Description:** Name of the company sending the email.
**Type:** String

- `{{socialIcons}}`
**Description:** Array of social media icons with URLs and image sources.
**Type:** Array of Objects
**Object Properties:**

- `url` **String:** URL for the social media profile.
- `imgSrc` **String:** URL of the social media icon image.
- `alt` **String:** Alt text for the social media icon.

- `{{supportUrl}}`
**Description:** URL to contact customer support.
**Type:** String

- `{{companyWebsite}}`
**Description:** URL of the company's website.
**Type:** String

- `{{preferencesUrl}}`
**Description:** URL for updating email preferences.
**Type:** String

- `{{unsubscribeUrl}}`
**Description:** URL for unsubscribing from the email list.
**Type:** String

## Expired Account Email Template Structure

This email template is designed for notifying users when their account activation link has expired and offers them the option to request a new activation link.

### Required Variables

- `{{title}}`
**Description:** The title of the email.
**Type:** String

- `{{logoUrl}}`
**Description:** URL of the logo image.
**Type:** String

- `{{imageUrl}}`
**Description:** URL of the image displayed in the email.
**Type:** String

- `{{userName}}`
**Description:** Name of the recipient.
**Type:** String

- `{{activationLinkUrl}}`
**Description:** URL for requesting a new activation link.
**Type:** String

- `{{companyName}}`
**Description:** Name of the company sending the email.
**Type:** String

- `{{socialIcons}}`
**Description:** Array of social media icons with URLs and image sources.
**Type:** Array of Objects
**Object Properties:**

- `url` **String:** URL for the social media profile.
- `imgSrc` **String:** URL of the social media icon image.
- `alt` **String:** Alt text for the social media icon.

- `{{supportUrl}}`
**Description:** URL to contact customer support.
**Type:** String

- `{{companyWebsite}}`
**Description:** URL of the company's website.
**Type:** String

- `{{preferencesUrl}}`
**Description:** URL for updating email preferences.
**Type:** String

- `{{unsubscribeUrl}}`
**Description:** URL for unsubscribing from the email list.
**Type:** String

## Account Activation Successful Email Template Structure

This email template is for welcoming a user after their account activation.

### Required Variables

- `{{title}}`
**Description:** The title of the email.
**Type:** String

- `{{logoUrl}}`
**Description:** URL of the logo image.
**Type:** String

- `{{imageUrl}}`
**Description:** URL of the image displayed in the email.
**Type:** String

- `{{userName}}`
**Description:** Name of the recipient.
**Type:** String

- `{{companyName}}`
**Description:** Name of the company sending the email.
**Type:** String

- `{{socialIcons}}`
**Description:** Array of social media icons with URLs and image sources.
**Type:** Array of Objects
**Object Properties:**
- `url` **String:** URL for the social media profile.
- `imgSrc` **String:** URL of the social media icon image.
- `alt` **String:** Alt text for the social media icon.

- `{{supportUrl}}`
**Description:** URL to contact customer support.
**Type:** String

- `{{companyWebsite}}`
**Description:** URL of the company's website.
**Type:** String

- `{{preferencesUrl}}`
**Description:** URL for updating email preferences.
**Type:** String

- `{{unsubscribeUrl}}`
**Description:** URL for unsubscribing from the email list.
**Type:** String

## Account Activation Request Email Template Structure

This HTML email template is designed to notify users about a login attempt from an unfamiliar device.

### Required Variables

- `{{title}}`
**Description:** The title of the email.
**Type:** String

- `{{logoUrl}}`
**Description:** URL of the logo image.
**Type:** String

- `{{imageUrl}}`
**Description:** URL of the main image displayed in the email.
**Type:** String

- `{{userName}}`
**Description:** Name of the recipient.
**Type:** String

- `{{activationLinkUrl}}`
**Description:** URL for activating the user's account.
**Type:** String

- `{{companyName}}`
**Description:** Name of the company sending the email.
**Type:** String

- `{{socialIcons}}`
**Description:** Array of social media icons with URLs and image sources.
**Type:** Array of Objects
**Object Properties:**

- `url` **String:** URL for the social media profile.
- `imgSrc` **String:** URL of the social media icon image.
- `alt` **String:** Alt text for the social media icon.

- `{{supportUrl}}`
**Description:** URL to contact customer support.
**Type:** String

- `{{companyWebsite}}`
**Description:** URL of the company's website.
**Type:** String

- `{{preferencesUrl}}`
**Description:** URL for updating email preferences.
**Type:** String

- `{{unsubscribeUrl}}`
**Description:** URL for unsubscribing from the email list.
**Type:** String

## Notes

- The `imageUrl` includes an `onerror` handler to hide the image if it fails to load.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"start:dev": "ts-node-dev --respawn --transpile-only ./src/index",
"start": "ts-node --transpile-only src/index.ts",
"test": "jest ",
"test:email": "jest views/email/tests",
"typeorm": "typeorm-ts-node-commonjs",
"build": "tsc",
"prod": "node dist/index.js",
Expand All @@ -26,6 +27,7 @@
},
"devDependencies": {
"@types/express": "^4.17.21",
"@types/fs-extra": "^11.0.4",
"@types/jest": "^29.5.12",
"@types/node": "^16.18.103",
"@types/supertest": "^6.0.2",
Expand All @@ -48,6 +50,7 @@
"dotenv": "^16.4.5",
"express": "^4.19.2",
"express-validator": "^7.1.0",
"fs-extra": "^11.2.0",
"handlebars": "^4.7.8",
"jest": "^29.7.0",
"jsonwebtoken": "^9.0.2",
Expand Down
Loading

0 comments on commit d38a661

Please sign in to comment.