Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/resend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
"@react-email/text": "^0.0.7",
"react": "^18.2.0",
"react-email": "2.1.1",
"resend": "^3.4.0"
"resend": "^4.0.0"
}
}
13 changes: 8 additions & 5 deletions internal/resend/src/client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class Resend {
const result = await this.client.emails.send({
to: req.email,
from: "james@updates.unkey.dev",
reply_to: this.replyTo,
replyTo: this.replyTo,
subject: "Your Unkey trial has ended",
html,
});
Expand All @@ -49,7 +49,7 @@ export class Resend {
const result = await this.client.emails.send({
to: req.email,
from: "james@updates.unkey.dev",
reply_to: this.replyTo,
replyTo: this.replyTo,
subject: "Your Unkey trial has ended",
html,
});
Expand All @@ -63,14 +63,17 @@ export class Resend {
}

public async sendWelcomeEmail(req: { email: string }) {
const fiveMinutesFromNow = new Date(Date.now() + 5 * 60 * 1000).toISOString();

const html = render(<WelcomeEmail />);
try {
const result = await this.client.emails.send({
to: req.email,
from: "james@updates.unkey.dev",
reply_to: this.replyTo,
replyTo: this.replyTo,
subject: "Welcome to Unkey",
html,
scheduledAt: fiveMinutesFromNow,
});
if (!result.error) {
return;
Expand All @@ -91,7 +94,7 @@ export class Resend {
const result = await this.client.emails.send({
to: req.email,
from: "james@updates.unkey.dev",
reply_to: this.replyTo,
replyTo: this.replyTo,
subject: "There was an issue with your payment",
html,
});
Expand All @@ -116,7 +119,7 @@ export class Resend {
const result = await this.client.emails.send({
to: email,
from: "james@updates.unkey.dev",
reply_to: this.replyTo,
replyTo: this.replyTo,
subject: "Unkey root key exposed in public Github repository",
html: html,
});
Expand Down
Loading