How do i send resend react email components??
This is in auth.ts for convex auth
im getting a failed to send error
verify: Resend({
id: "verification",
apiKey: process.env.RESEND_API_KEY,
maxAge: VerificationCodesExpiration,
generateVerificationToken() {
const random: RandomReader = {
read(bytes) {
crypto.getRandomValues(bytes)
}
}
const alphabet = "0123456789"
const length = 6
return generateRandomString(random, alphabet, length)
},
async sendVerificationRequest({ identifier: email, provider, token }) {
const resend = new ResendApi(provider.apiKey)
const { error } = await resend.emails.send({
from: `${siteConfig.name} <${siteConfig.email.noreply}>`,
to: [email],
subject: `Verify your email - ${siteConfig.name}`,
text: `Your verification code is ${token}`,
react: VerifyEmail({
code: token,
expiry: new Date(Date.now() + VerificationCodesExpiration * 1000)
})
})
if (error) {
throw new ConvexError({
kind: "EmailSendFailed",
message: error.toString() || "Failed to send verification email"
})
}
}
}),verify: Resend({
id: "verification",
apiKey: process.env.RESEND_API_KEY,
maxAge: VerificationCodesExpiration,
generateVerificationToken() {
const random: RandomReader = {
read(bytes) {
crypto.getRandomValues(bytes)
}
}
const alphabet = "0123456789"
const length = 6
return generateRandomString(random, alphabet, length)
},
async sendVerificationRequest({ identifier: email, provider, token }) {
const resend = new ResendApi(provider.apiKey)
const { error } = await resend.emails.send({
from: `${siteConfig.name} <${siteConfig.email.noreply}>`,
to: [email],
subject: `Verify your email - ${siteConfig.name}`,
text: `Your verification code is ${token}`,
react: VerifyEmail({
code: token,
expiry: new Date(Date.now() + VerificationCodesExpiration * 1000)
})
})
if (error) {
throw new ConvexError({
kind: "EmailSendFailed",
message: error.toString() || "Failed to send verification email"
})
}
}
}),im getting a failed to send error
