Veloz support sending of mails using Resend
due to it simplicity. If you dont have a resend account , create one here (opens in a new tab).
Resend
Setup 🛠
Head over to your resend dashboard and create a new API Key as seen in the image below.
Once that completed, navigate to the Domain section and add a new domain. If you dont have one, you could purchase one from Namecheap (opens in a new tab) or Godaddy (opens in a new tab).
Make sure it verified before proceeding further.
Now, Copy the API Key alongside your Domain Name and head over to your project .env
file and update the following variable.
Usage 🚀
Veloz provide a reusable promise base function based on the preferred mail provider. It differ based on the language of choice.
Javascript
Next.js (app router)
Simply headover to src/app/api/config/email/resend.(ts)
a function called resendSendMail()
has been provided for you. It accept the following parameters.
to
- The recipient email address or addresses.subject
- The subject of the mail.htmlData
- The html content of the mail.
The htmlData
variable holds the HTML content of the email.
Veloz provides a base email template located in src/email-template
.
Find it in the preview
folder for designing your HTML mail template.
Once completed, copy it and create a function in src/email-template/
.
For mail templates with dynamic data, create a reusable function
similar to the one in src/email-template/welcome-template.(ts/js)
.
If the current approach doesn't suit your comfort level, feel free to modify this function according to your preferred approach.
Using the resendSendMail()
function, you can send mail to a single or multiple recipients.