npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@hbertoson/astro-mailer

v1.0.1

Published

Astro Mailer Integration

Readme

Astro Mailer

Astro Mailer is an Astro integration that enables you to send email notifications via any SMTP service using Nodemailer. This is perfect for handling form submissions, alerts, or transactional messages in your Astro project.

Features

  • Send email notifications from your Astro site using SMTP.
  • Capture form data and pass it into customizable email templates.
  • Supports custom headers such as X-Entity-Ref-ID and List-Unsubscribe.
  • Compatible with Astro’s server-side routing and form handling.
  • Flexible SMTP configuration for any provider (e.g., Gmail, SendGrid, Mailgun, etc).

Prerequisites

You’ll need access to any SMTP server. For example:

  • Gmail
  • SendGrid
  • Amazon SES
  • Mailgun
  • SMTP2GO
  • Postmark
  • Mailjet
  • Zoho Mail
  • Office 365
  • Any other SMTP service

Installation

Install via the Astro CLI:

pnpm astro add @hbertoson/astro-mailer
npm astro add @hbertoson/astro-mailer
yarn astro add @hbertoson/astro-mailer

Or manually:

  1. Install dependencies:
pnpm add @hbertoson/astro-mailer
  1. Add it to your Astro config:
import mailer from '@hbertoson/astro-mailer';

export default defineConfig({
  integrations: [
    mailer({
      smtp: {
        host: 'smtp.example.com',
      },
      templates: {
        welcome: './src/components/emails/WelcomeEmail.astro',
      },
    }),
  ],
});

.env Setup

[email protected]
SMTP_PASS=yourpassword
[email protected]

Configuration Options

| Option | Type | Required | Description | | ------------------ | --------- | -------- | --------------------------------- | | fromEmail | string | ✅ | Sender email address | | smtp | object | ✅ | SMTP configuration for Nodemailer | | templates | object | ✅ | Named Astro components for emails | | preventThreading | boolean | ❌ | Prevent Gmail threading | | unsubscribeUrl | string | ❌ | Add List-Unsubscribe header | | verbose | boolean | ❌ | Enable debug logging |

Usage Example

<body>
  <h1>Astro Mailer</h1>
  <button>Send Email</button>
		<script>
			const button = document.querySelector('button') as HTMLButtonElement;
			button.addEventListener('click', async () => {
				const emailData: BaseEmailRequest = {
					to: '[email protected]',
					subject: 'Test Email',
					templateName: 'email',
					props: {
						name: 'Hunter',
						content: 'This is a test email. From my Astro Mailer Integration',
					},
				};
				const res = await fetch('api/email', {
					method: 'POST',
					headers: {
						'Content-Type': 'application/json',
					},
					body: JSON.stringify(emailData),
				});
				if (res.ok) {
					const data = await res.json();
					console.log('Email sent successfully:', data);
				} else {
					console.error('Error sending email:', res.statusText);
				}
			});
		</script>
</body>

Roadmap

  • [ ] Add CC and BCC support
  • [ ] Async form binding example
  • [ ] File attachments
  • [ ] Email queues with retry
  • [ ] SMTP transport pool option

Contributing

This repo is structured as a monorepo:

  • playground: example Astro project to test the integration
  • package: source code of the integration

Start developing:

pnpm i --frozen-lockfile
pnpm dev

Acknowledgements

MIT License