Skip to content

Commit

Permalink
fix reply_to format
Browse files Browse the repository at this point in the history
  • Loading branch information
ekulno committed Jun 28, 2024
1 parent ffc1113 commit a06b595
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const resend = new Resend(process.env['RESEND_API_KEY'])
interface ContactRequest {
email: string;
message: string;
name?: string;
subject?: string;
};

Expand All @@ -39,7 +38,7 @@ app.get('/contact', async (req, res)=>{
});

app.post("/contact", async (req, res) => {
const { email, message, name, subject } = req.body as ContactRequest;
const { email, message, subject } = req.body as ContactRequest;
if (!validateEmail(email)) {
res.status(400).send("Invalid email");
return;
Expand All @@ -50,7 +49,7 @@ app.post("/contact", async (req, res) => {
}
const info = await resend.emails.send({
from: fromMail,
reply_to: `${name?`"${name}"`:''} <${email}>`,
reply_to: email,
to: toMail,
subject: subject || "Contact form message",
text: message
Expand Down

0 comments on commit a06b595

Please sign in to comment.