sendgrid email

If sendgrid is used with a client contact form, where would the user's email be placed in the sendgrid object you're sending? A lot of examples use hard coded values, while most real world scenarios will need to be dynamic data like from a contact us form. Where does your verified email go & where does the user's email go?
1 Reply
Nick
Nick4mo ago
Not sure if it will help (as from memory I think I'm using the web api as opposed to their normal api), but this is what I do:
const emailMessage = {
personalizations: [{
to: [
{email: import.meta.env.TARGET_EMAIL, name: "Target"},
{email: import.meta.env.CC_EMAIL, name: "CC"}
],
}],
from: {email:import.meta.env.MY_EMAIL, name:"The Server"},
replyTo: {email:email},
subject: `ENQUIRY from ${fName} ${sName}`,
content: [
{
type: 'text/html',
value: `${message}`,
},
],
}
const emailMessage = {
personalizations: [{
to: [
{email: import.meta.env.TARGET_EMAIL, name: "Target"},
{email: import.meta.env.CC_EMAIL, name: "CC"}
],
}],
from: {email:import.meta.env.MY_EMAIL, name:"The Server"},
replyTo: {email:email},
subject: `ENQUIRY from ${fName} ${sName}`,
content: [
{
type: 'text/html',
value: `${message}`,
},
],
}
Want results from more Discord servers?
Add your server