Resend error?
Answered
Ojos Azules posted this in #help-forum
Ojos AzulesOP
Here is a code that sends mail with details of user's appointment. But sometimes i don't get the mail from Resend. Does it has to do with my code structure or its resend's issue? I can't find something online with the same "issue". Any help? Thanks.
Code:
Code:
import { AppointmentEmail } from "@/react-email-starter/emails/create-email";
import { AppointmentGREmail } from "@/react-email-starter/emails/create-gr-email";
import { Resend } from "resend"
import{render} from "@react-email/render"
const resend = new Resend(process.env.RESEND_API_KEY);
export const sendEmail = async (
clientName: string,
clientEmail: string,
serviceName: string,
servicePrice: number,
barber: string,
day: Date,
time: string,
lang: string
) => {
if(lang === "gr") {
await resend.emails.send({
from: "mail@Test.gr",
to: clientEmail,
subject: "Το ραντεβού σας στο Test",
html:render(AppointmentGREmail(clientName, clientEmail, serviceName, servicePrice, barber, day, time))
});
} else {
await resend.emails.send({
from: "mail@Test.gr",
to: clientEmail,
subject: "Your Appointment at Test",
html:render(AppointmentEmail(clientName, clientEmail, serviceName, servicePrice, barber, day, time))
});
}
};Answered by averydelusionalperson
NP, logs are important. always check logs when something doesn't work
27 Replies
you can check logs when the mail isn't sent 🤷♂️
do you get any error, logs? or it runs fine in the code, but does not send email?
Ojos AzulesOP
Everything works fine
Also i get the appointment in my website dashboard
so mail for some reason does not deliver
But sometimes thats the weird thing
80% of mails are delivered
the rest 20% are lost for some reason... Even resend doesnt log me smthing
does resend have a logs page of some sort? There should be something different in the logs or something. Resend is used by many and is a trusted service. So I highly doubt the mails are lost for some reason.
Ojos AzulesOP
Only succesful emails
so, every one of the emails shown above has been delivered successfully?
Ojos AzulesOP
yy
So, the emails that haven't been sent are not showing up here, in the logs?
Ojos AzulesOP
Nop :/
I would say this is issue from your code side, the resend service is not getting called at all 

I've never used resend, but I think they show all mail logs even if they aren't sent
Ojos AzulesOP
Maybe is code side that is that i think buty i cant understand why sometimes works and sometimes doesnt
you need the check the logs in your code side, when it doesn't work sometimes
Ojos AzulesOP
ok mate
thanks
NP, logs are important. always check logs when something doesn't work
Answer
consider marking any message as solution if it was helpful
Ojos AzulesOP
I will do it sure but give me some time to see if i will get the solution by making logs as you said
Ojos AzulesOP
🙏🏿