Reply to not capturing sender

I integreted the email.jsw, sendGrid.js and the main page code and i am trying to have the notification sent to me have the reply to field set to the email sender email field in the form. What do i need to change

Sanjay

Hi there,

Would you be able to provide your code and results, so we can understand the issue a little better?

If you haven’t’ already I’d also suggest taking a look at this helpful example.
https://www.wix.com/corvid/forum/community-discussion/example-send-email-with-the-sendgrid-rest-interface

Hi Sorry for late reply.

As a reminder i would like the resulting email have the reply to use the submitters email address.

Here is the code on the page:

import {sendEmail, sendEmailWithRecipient} from ‘backend/email’ ;

$w.onReady( function () {
$w( “#dataset1” ).onAfterSave(sendFormData);
});

function sendFormData() {
const subject = ${$w( "#input2" ).value} needs a quote **for** an event;
const body = New client request from : ${$w( "#input2" ).value} \rName: ${$w( "#input2" ).value} \rEmail: ${$w( "#input3" ).value} \rPhone: ${$w( "#input4" ).value} \rEvent Type: ${$w( "#dropdown3" ).value} const subjectreply = Dhaba7 enquiry reply - Thanks; const bodyreply = Hi ${$w( “#input2” ).value}
\r
\rThank you for sending your enquiry to Dhaba7
\r
\rWe hope to get back to you shortly.
\r
\rThanks
\r
\rthe Dhaba7 Team
\r
\r
\r

\rYour submission was 

\rName: ${$w( "#input2" ).value} 
\rEmail: ${$w( "#input3" ).value} 
\rPhone: ${$w( "#input4" ).value} 
\rEvent Type: ${$w( "#dropdown3" ).value} 

const recipient = $w( “#input3” ).value;
sendEmailWithRecipient(subjectreply, bodyreply, recipient)
.then(response => console.log(response));

sendEmail(subject, body)
.then(response => console.log(response));
}

This is the //email.jsw

import { sendWithService } from ‘backend/sendGrid’ ;

export function sendEmail(subject, body) {
const key = “xxxxx” ;
const sender = “info@dhaba7.com” ;
const recipient = “info@dhaba7.com” ;
return sendWithService(key, sender, recipient, subject, body);
}

export function sendEmailWithRecipient(subjectreply, bodyreply, recipient) {
const key = “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” ;
const sender = “info@dhaba7.com” ;
return sendWithService(key, sender, recipient, subjectreply, bodyreply);
}

And this is //sendGrid.js

import {fetch} from ‘wix-fetch’ ;

export function sendWithService(key, sender, recipient, subject, body) {
const url = “https://api.sendgrid.com/api/mail.send.json” ;

const headers = {
“Authorization” : "Bearer " + key,
“Content-Type” : “application/x-www-form-urlencoded”
};

const data = from =${sender}&to=${recipient}&subject=${subject}&text=${body};

const request = {
“method” : “post” ,
“headers” : headers,
“body” : data
};

return fetch(url, request)
.then(response => response.json());
}

Thanks for your help
Sanjay