
Security News
OpenCode User Hit with Hostile Backlash After Reporting Free AI Loophole
An OpenCode user faced harassment after reporting a free AI usage loophole, drawing a bitter backlash in a GitHub thread that has since been deleted.
convex-aws-ses
Advanced tools
This component integrates AWS Simple Email Service (SES) with your Convex project.
Features:
See example for a demo of how to incorporate this component into your application.
npm install convex-aws-ses
Set up your AWS credentials in your deployment environment:
AWS_REGION (or AWS_DEFAULT_REGION)AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYSES_CONFIGURATION_SET_NAME (optional, required for event tracking)SES_PRODUCTION_MODE (set to true to disable test mode and send to any address)SES_DEBUG (set to true to enable debug logging)Next, add the component to your Convex app via convex/convex.config.ts:
import { defineApp } from "convex/server";
import ses from "convex-aws-ses/convex.config.js";
const app = defineApp();
app.use(ses);
export default app;
Then you can use it, as we see in convex/sendEmails.ts:
import { components } from "./_generated/api";
import { Ses } from "convex-aws-ses";
import { internalAction } from "./_generated/server";
export const ses: Ses = new Ses(components.ses, {});
export const sendTestEmail = internalAction({
handler: async (ctx) => {
await ses.sendEmail(ctx, {
from: "sender@yourdomain.com",
to: "recipient@example.com",
subject: "Hi there",
html: "This is a test email",
});
},
});
Then, calling sendTestEmail from anywhere in your app will send this test
email.
Note: In SES sandbox mode, both sender and recipient addresses must be verified. Move to production mode to send to any address.
If you want to send emails to real addresses, you need to disable testMode.
You can do this in SesOptions,
as detailed below.
While the setup we have so far will reliably send emails, you don't have any feedback on anything delivering, bouncing, or triggering spam complaints. For that, we need to set up SNS notifications!
SES_CONFIGURATION_SET_NAME environment variableOn the Convex side, we need to mount an http endpoint to our project to route it
to the SES component in convex/http.ts:
import { httpRouter } from "convex/server";
import { httpAction } from "./_generated/server";
import { ses } from "./sendEmails";
const http = httpRouter();
http.route({
path: "/ses-notifications",
method: "POST",
handler: httpAction(async (ctx, req) => {
return await ses.handleSnsNotification(ctx, req);
}),
});
export default http;
If our Convex project is happy-leopard-123, we now have an SNS endpoint for our
project running at https://happy-leopard-123.convex.site/ses-notifications.
Subscribe your SNS topic to this HTTPS endpoint. The component will automatically handle subscription confirmation.
You should now be seeing email status updates as SES makes progress on your emails!
If you have your SNS notifications established, you can also register an event handler in your app to get notifications when email statuses change.
Update your sendEmails.ts to look something like this:
import { components, internal } from "./_generated/api";
import { internalMutation } from "./_generated/server";
import { vOnEmailEventArgs, Ses } from "convex-aws-ses";
export const ses: Ses = new Ses(components.ses, {
onEmailEvent: internal.example.handleEmailEvent,
});
export const handleEmailEvent = internalMutation({
args: vOnEmailEventArgs,
handler: async (ctx, args) => {
// Handle however you want
// args provides { id: EmailId; event: EmailEvent; }
// see /example/example.ts
},
});
Check out the example/ project in this repo for a full demo.
There is a SesOptions argument to the component constructor to help
customize its behavior.
Check out the docstrings, but notable options include:
region: AWS region for SES (defaults to AWS_REGION env var)accessKeyId: AWS access key (defaults to AWS_ACCESS_KEY_ID env var)secretAccessKey: AWS secret key (defaults to AWS_SECRET_ACCESS_KEY env var)configurationSetName: SES Configuration Set name for event trackingtestMode: Only allow delivery to verified addresses. To keep you safe as you
develop your project, testMode is default true. You need to explicitly
set this to false for the component to allow you to enqueue emails to
arbitrary addresses.onEmailEvent: Your email event callback, as outlined above! Check out the
docstrings for details on the events that are
emitted.In addition to basic from/to/subject and html/plain text bodies, the sendEmail
method allows you to provide a list of replyTo addresses, cc, bcc, and
custom email headers.
You can use SES templates to send emails with pre-designed templates from your AWS account. To use a template, provide the template name and any required template data:
await ses.sendEmail(ctx, {
from: "sender@yourdomain.com",
to: "recipient@example.com",
template: {
name: "MyTemplateName",
data: {
name: "John Doe",
verificationLink: "https://example.com/verify?token=abc123",
},
},
});
[!IMPORTANT] You cannot use both
templateandhtml/textin the same email. If you need to send dynamic HTML content, either use templates with template data, or use thehtml/textfields directly.
The sendEmail method returns a branded type, EmailId. You can use this for a
few things:
ses.status(ctx, emailId).ses.cancelEmail(ctx, emailId).If the email has already been sent to the SES API, it cannot be cancelled. Cancellations do not trigger an email event.
Use the status method to check an email's current state:
const emailStatus = await ses.status(ctx, emailId);
if (emailStatus) {
console.log(emailStatus.status); // e.g., "delivered", "bounced", "sent"
console.log(emailStatus.bounced); // boolean
console.log(emailStatus.failed); // boolean
console.log(emailStatus.complained); // spam complaint (boolean)
console.log(emailStatus.deliveryDelayed); // boolean
console.log(emailStatus.opened); // if open tracking enabled (boolean)
console.log(emailStatus.clicked); // if click tracking enabled (boolean)
console.log(emailStatus.errorMessage); // error details (string | null)
}
You can view all email data directly in your Convex dashboard in the component's data view. Click the drop down with a puzzle piece that says app:

Emails table: Navigate to your Convex dashboard → Data. Choose ses
from the component drop down then choose the emails table. This shows all
emails with their current status, recipients, subjects, and tracking
information.
Delivery Events table: Navigate to Components → ses →
deliveryEvents table. This table stores all SNS events received from
SES, including:
emailId: Links back to the email in the emails tablesesMessageId: SES's ID for the emaileventType: The type of event (e.g., Delivery, Bounce,
Open, Click, Complaint)createdAt: When the event occurredmessage: Additional details (e.g., bounce reasons)This is useful for debugging delivery issues, viewing email history, and understanding what happened with each email you sent.
This component retains "finalized" (delivered, cancelled, bounced) emails. It's
your responsibility to clear out those emails on your own schedule. You can run
cleanupOldEmails and cleanupAbandonedEmails from the dashboard, under the
"ses" component tab in the function runner, or set up a cron job.
If you pass no argument, it defaults to deleting emails older than 7 days.
If you don't care about historical email status, the recommended approach is to use a cron job, as shown below:
// in convex/crons.ts
import { cronJobs } from "convex/server";
import { components, internal } from "./_generated/api.js";
import { internalMutation } from "./_generated/server.js";
const crons = cronJobs();
crons.interval(
"Remove old emails from the SES component",
{ hours: 1 },
internal.crons.cleanupSes,
);
const ONE_WEEK_MS = 7 * 24 * 60 * 60 * 1000;
export const cleanupSes = internalMutation({
args: {},
handler: async (ctx) => {
await ctx.scheduler.runAfter(0, components.ses.lib.cleanupOldEmails, {
olderThan: ONE_WEEK_MS,
});
await ctx.scheduler.runAfter(
0,
components.ses.lib.cleanupAbandonedEmails,
// These generally indicate a bug, so keep them around for longer.
{ olderThan: 4 * ONE_WEEK_MS },
);
},
});
export default crons;
You can use React Email to generate your HTML for you from JSX.
First install the dependencies:
npm install @react-email/components react react-dom react-email @react-email/render
Then create a new .tsx file in your Convex directory e.g. /convex/emails.tsx:
// IMPORTANT: this is a Convex Node Action
"use node";
import { action } from "./_generated/server";
import { render, pretty } from "@react-email/render";
import { Button, Html } from "@react-email/components";
import { components } from "./_generated/api";
import { Ses } from "convex-aws-ses";
export const ses: Ses = new Ses(components.ses, {
testMode: false,
});
export const sendEmail = action({
args: {},
handler: async (ctx, args) => {
// 1. Generate the HTML from your JSX
// This can come from a custom component in your /emails/ directory
// if you would like to view your templates locally. For more info see:
// https://react.email/docs/getting-started/manual-setup#5-run-locally
const html = await pretty(
await render(
<Html>
<Button
href="https://example.com"
style={{ background: "#000", color: "#fff", padding: "12px 20px" }}
>
Click me
</Button>
</Html>,
),
);
// 2. Send your email as usual using the component
await ses.sendEmail(ctx, {
from: "sender@yourdomain.com",
to: "recipient@example.com",
subject: "Hi there",
html,
});
},
});
[!WARNING] React Email requires some Node dependencies thus it must run in a Convex Node action and not a regular Action.
If you need fine-grained control over the email sending process, you can send
emails manually using sendEmailManually. Unlike sendEmail which enqueues
emails and sends them via the batching system, sendEmailManually lets you
call the SES API directly while still tracking progress using the component's
status and event APIs.
import { components, internal } from "./_generated/api";
import { internalAction } from "./_generated/server";
import { Ses } from "convex-aws-ses";
import {
SESv2Client,
SendEmailCommand,
} from "@aws-sdk/client-sesv2";
const sesClient = new SESv2Client({
region: process.env.AWS_REGION,
credentials: {
accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!,
},
});
export const ses = new Ses(components.ses, {});
export const sendManualEmail = internalAction({
args: {},
handler: async (ctx, args) => {
const from = "sender@yourdomain.com";
const to = ["recipient@example.com"];
const subject = "hello world";
const html = "<p>it works!</p>";
const emailId = await ses.sendEmailManually(
ctx,
{ from, to, subject },
async (emailId) => {
const command = new SendEmailCommand({
FromEmailAddress: from,
Destination: { ToAddresses: to },
Content: {
Simple: {
Subject: { Data: subject },
Body: { Html: { Data: html } },
},
},
ConfigurationSetName: process.env.SES_CONFIGURATION_SET_NAME,
});
const response = await sesClient.send(command);
if (!response.MessageId) {
throw new Error("No MessageId returned from SES");
}
return response.MessageId;
},
);
return emailId;
},
});
Use sendEmailManually when you need features not supported by the standard
API, such as attachments, or when you want to send an email immediately without
waiting for the batching system.
FAQs
An AWS SES email component for Convex.
The npm package convex-aws-ses receives a total of 78 weekly downloads. As such, convex-aws-ses popularity was classified as not popular.
We found that convex-aws-ses demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
An OpenCode user faced harassment after reporting a free AI usage loophole, drawing a bitter backlash in a GitHub thread that has since been deleted.

Threat Research
/Security News
319 browser extensions installed by 13.4 million users hijack searches, capture queries, and collect referral payments from Yahoo and Bing.

Threat Research
Malicious Firefox extensions mimic Phantom, Jupiter, and Bitget wallets to steal recovery phrases and private keys, with one fetching its payload remotely.