Hello I have the following Array of Objects: recipients: [ { responded: false, _id: 61ef2b6dbac083198d934dfd, email: 'myemail1@gmail.com' }, { responded: false, _id: 61ef2b6dbac083198d934dfe, email: 'myemail2@gmail.com' } ] Code (JavaScript): and I need the following result: sendSmtpEmail.to = [ {"email":"myemail1@gmail.com", "name":"myemail1@gmail.com"}, {"email":"myemail2@gmail.com", "name":"myemail2@gmail.com"}; ]; Code (JavaScript): The following approach does not work: sendSmtpEmail.to = recipients.map((recipient) => { return { email: recipient.email, name: recipient.email }; }); Code (JavaScript): How can I map this correctly? Thanks, iago
works for me - only thing I changed in your code was to put quotes around the id string. https://jsfiddle.net/e7n6a4d1/
Ok, thanks @sarahk for this, probably the sendSmptEmail object is not correctly configured with that input. That's an email service called sendinblue