Mail sees 2 from addresses when name enabled
I have the following script:
And I don't really understand why... after all the
The form input is good, there are no issues there
const sendForm = async (form) => {
let sendRequest = new Request('https://api.mailchannels.net/tx/v1/send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
personalizations: [
{
to: [{ email: 'web-contactus@sbsoftware.ca' }],
},
],
from: {
email: form.email,
name: `${form.lname}, ${form.fname}`, // Causes an ERROR (multiple from addresses)
},
subject: `Contact Us - ${form.lname}, ${form.fname} (${form.subject})`,
content: [
{
type: 'text/html',
value: form.message,
},
],
}),
});
const response = await fetch(sendRequest);
const responseText = await response.text();
return responseText;
};const sendForm = async (form) => {
let sendRequest = new Request('https://api.mailchannels.net/tx/v1/send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
personalizations: [
{
to: [{ email: 'web-contactus@sbsoftware.ca' }],
},
],
from: {
email: form.email,
name: `${form.lname}, ${form.fname}`, // Causes an ERROR (multiple from addresses)
},
subject: `Contact Us - ${form.lname}, ${form.fname} (${form.subject})`,
content: [
{
type: 'text/html',
value: form.message,
},
],
}),
});
const response = await fetch(sendRequest);
const responseText = await response.text();
return responseText;
};And I don't really understand why... after all the
from:from: field is an object, not an array...The form input is good, there are no issues there