This product is a helper built from the resend email package.
It is used to send an email from an application to the email of a user. It can be extended to serve confirmation message or mass email sender.
- Add domain and API key to .env.local
- Include the in config/email-domains.ts
- Push to create an updated build
- Start emailing...
It takes the following arguements:
from: This defines the sender. It is used to represent the domain of the product.to: The email(s) of the recipients.subject: The subject of the email being sent.firstName: A name of the recipient to personalize the message of the email.product: The product name, app name, etc.logoUrl: a hosted link of the product's logo.support: A support email for users.
code: A code sent to the recipient, in the event of email confirmations.
resetToken: A code sent to the recipient, in the event of email verification and complementary to the reset/verify button.resetUrl: A link sent to the recipient, in the event of email verification, rendered in the reset/verify button.
You can send a confirmation email using a POST request to the /v1/confirmation endpoint. Here are examples of how to use the endpoint:
POST http://localhost:3000/v1/confirmation
Content-Type: application/json
{
"from": "no-reply@techverseacademy.com",
"to": "['user@example.com']",
"product": "Techverse Academy",
"firstName": "John",
"subject": "Confirm your account",
"code": "202456"
}You can specify different email templates using the template parameter:
# Corporate Template
POST http://localhost:3000/v1/confirmation
Content-Type: application/json
{
"from": "no-reply@techverseacademy.com",
"to": "['user@example.com']",
"product": "Techverse Academy",
"firstName": "John",
"subject": "Confirm your account",
"code": "202456",
"template": "corporate"
}
# Elegant Template
POST http://localhost:3000/v1/confirmation
Content-Type: application/json
{
"from": "no-reply@techverseacademy.com",
"to": "['user@example.com']",
"product": "Techverse Academy",
"firstName": "John",
"subject": "Confirm your account",
"code": "202456",
"template": "elegant"
}You can send a URL verification email using a POST request to the /v1/url-verify endpoint:
POST http://localhost:3000/v1/url-verify
Content-Type: application/json
{
"from": "no-reply@techverseacademy.com",
"to": "['user@example.com']",
"product": "Techverse Academy",
"firstName": "John",
"subject": "Verify Your Account",
"resetToken": "5HF980",
"resetUrl": "http://localhost:3000/verify"
}# Corporate Template
POST http://localhost:3000/v1/url-verify
Content-Type: application/json
{
"from": "no-reply@techverseacademy.com",
"to": "['user@example.com']",
"product": "Techverse Academy",
"firstName": "John",
"subject": "Verify Your Account",
"resetToken": "5HF980",
"resetUrl": "http://localhost:3000/verify",
"template": "corporate"
}
# Creative Template
POST http://localhost:3000/v1/url-verify
Content-Type: application/json
{
"from": "no-reply@techverseacademy.com",
"to": "['user@example.com']",
"product": "Techverse Academy",
"firstName": "John",
"subject": "Verify Your Account",
"resetToken": "5HF980",
"resetUrl": "http://localhost:3000/verify",
"template": "creative"
}default: Standard confirmation emailcorporate: Corporate-style email templateelegant: Elegant email templateminimal: Minimalist email templatetech: Tech-oriented email template
default: Standard URL verification emailcorporate: Corporate-style URL verification emailcreative: Creative URL verification emailminimalist: Minimalist URL verification emailtech: Tech-oriented URL verification email