Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

211
Views
Node.js - SendGrid: no se envía a los destinatarios de mi matriz (solo en modo de producción)

Mi entorno:

 "next": "^12.0.8", "@sendgrid/mail": "^7.6.1"

Mi código - API:

 import sendgrid from '@sendgrid/mail'; sendgrid.setApiKey(process.env.SENDGRID_API_KEY); export default async function sendEmailDestinataire(req, res) { const msg = { to: req.body.email, from: { email: 'contact@aaaaaaa.fr', name: 'From my name', }, templateId: 'd-xxxxxxxxxxxxxxxxx', dynamic_template_data: { name: req.body.name, email: req.body.email, message: req.body.message, file: req.body.file, }, }; console.log('===================================='); console.log('api msg', msg.to); console.log('===================================='); try { await sendgrid.sendMultiple(msg); res.json({ message: `Email has been sent` }); } catch (error) { res.status(500).json({ error: 'Error sending email' }); } }

Mi código - FRENTE

 let listEmails = ''; if (getUserMail.edges && getUserMail?.edges[0]?.node?.email === email) { const tmpListEmails = getUserMail.edges[0]?.node?.listeEmails?.emails; listEmails = tmpListEmails.replace(' ', '').split(','); } const res2 = await fetch('/api/sendgridDestinataire', { body: JSON.stringify({ email: listEmails.length > 0 ? listEmails : email, name: name, file: allUrls, message: message, }), headers: { 'Content-Type': 'application/json', }, method: 'POST', }); await res.json();

Mi problema :

En mi entorno de desarrollo todo funciona bien. Pero cuando estoy en producción, el correo electrónico se envía al estado de correo electrónico. Y no, a los de mi matriz. La variable de correo electrónico transmitida a la API me devuelve el objeto...

Gracias de antemano por su ayuda.

Y lo siento por mi Inglés

bruce

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Hola Juan Pablo, lograste solucionarlo? Tengo el mismo problema

over 2 years ago · Mariana Agudelo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!