Sending Emails with Postmark
Browse the source code here.
LaunchFa.st makes it easier for you to send emails with Postmark with it’s built-in integration.
Here’s how you would set up Postmark to use it with LaunchFast:
-
Create a Postmark account.
-
Add your verified domain(s) and sender signatures by completing the steps in their domain guide.
-
Set up common steps for improving deliverability rates by completing the steps in their authentication guide
-
Obtain the Postmark API key from the Setup Instructions.
-
Make sure to update the environment variable(s) of your application per the following instruction:
To send emails with Postmark, use sendEmail
utility inside your server-side code:
import { sendEmail } from '@/lib/utils/email'import type { APIContext } from 'astro'
export async function GET({ request }: APIContext) { // From a server-side API that is being fetched
// Send an email using Resend // Read more on https://resend.com/docs/api-reference/emails/send-email await sendEmail({ text: context.text, subject: context.subject, from: 'Rishi Raj Jain <emails@rishi.app>', to: typeof context.to === 'string' ? [context.to] : context.to, }, 'postmark')}
export async function POST({ request }: APIContext) { // From a server-side API that is being POST-ed to
// Send an email using Resend // Read more on https://resend.com/docs/api-reference/emails/send-email await sendEmail({ text: context.text, subject: context.subject, from: 'Rishi Raj Jain <emails@rishi.app>', to: typeof context.to === 'string' ? [context.to] : context.to, }, 'postmark')}