diff --git a/src/pages/Contact.tsx b/src/pages/Contact.tsx index e026327..083e82b 100644 --- a/src/pages/Contact.tsx +++ b/src/pages/Contact.tsx @@ -71,28 +71,29 @@ export function Contact() { email: formData.email, title: formData.subject, message: formData.message, + reply_to: formData.email, }; - await Promise.all([ - // Send to Admin - emailjs.send( - config.emailJs.serviceId, - config.emailJs.templateIdAdmin, - templateParams, - { publicKey: config.emailJs.publicKey } - ), - // Send Auto-reply to User - emailjs.send( - config.emailJs.serviceId, - config.emailJs.templateIdUser, - templateParams, - { publicKey: config.emailJs.publicKey } - ), - ]); + // Send to Admin + await emailjs.send( + config.emailJs.serviceId, + config.emailJs.templateIdAdmin, + templateParams, + { publicKey: config.emailJs.publicKey } + ); + + // Send Auto-reply to User + await emailjs.send( + config.emailJs.serviceId, + config.emailJs.templateIdUser, + templateParams, + { publicKey: config.emailJs.publicKey } + ); setSubmitStatus('success'); setFormData({ name: '', email: '', subject: '', message: '' }); - } catch { + } catch (error) { + console.error('EmailJS Error:', error); setSubmitStatus('error'); } finally { setIsSubmitting(false); diff --git a/src/pages/__tests__/Contact.test.tsx b/src/pages/__tests__/Contact.test.tsx index 4dd0958..515eebb 100644 --- a/src/pages/__tests__/Contact.test.tsx +++ b/src/pages/__tests__/Contact.test.tsx @@ -82,6 +82,7 @@ describe('Contact Page', () => { email: 'john@example.com', title: 'Test Subject', message: 'Hello world', + reply_to: 'john@example.com', }; const expectedOptions = {