Skip to content

Commit

Permalink
add replyto to feedback email
Browse files Browse the repository at this point in the history
  • Loading branch information
KMKoushik committed Aug 27, 2024
1 parent ec1155f commit 70bef02
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ yarn-error.log*
**/public/sw.js.map
**/public/worker-*.js
src/server/random.code-workspace

certificates
11 changes: 9 additions & 2 deletions src/server/mailer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,16 @@ export async function sendFeedbackEmail(feedback: string, user: User) {
const subject = `Feedback received on SplitPro from ${user.name}`;
const text = `Feedback created by ${user.name} :\n\nFeedback: ${feedback}\n\nemail: ${user.email}`;

await sendMail(env.FEEDBACK_EMAIL, subject, text, text);
await sendMail(env.FEEDBACK_EMAIL, subject, text, text, user.email ?? undefined);
}

async function sendMail(email: string, subject: string, text: string, html: string) {
async function sendMail(
email: string,
subject: string,
text: string,
html: string,
replyTo?: string,
) {
try {
if (unsend) {
const response = await unsend.emails.send({
Expand All @@ -54,6 +60,7 @@ async function sendMail(email: string, subject: string, text: string, html: stri
subject,
text,
html,
replyTo,
});

if (response.data) {
Expand Down

0 comments on commit 70bef02

Please sign in to comment.