Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let msg = {
- to: TEAM_EMAILS,
- from: 'BostonHacks <contact@bostonhacks.io>',
- replyTo: req.body.from,
- subject: req.body.subject,
- text: req.body.text
- };
- simpleParser(req.body.email, { skipImageLinks: true })
- .then(parsed => {
- UPDATE MSG WITH STUFF FROM PARSED
- const msg = {
- to: TEAM_EMAILS,
- from: 'BostonHacks <contact@bostonhacks.io>',
- replyTo: req.body.from,
- subject: req.body.subject,
- text: req.body.text,
- ....
- };
- })
- .catch(error => {
- console.error("Failed to parse email:", error);
- console.log("Sending email text as fallback");
- });
- sgMail
- .sendMultiple(msg)
- .then(() => {
- console.log('Email forwarded!');
- res.send('Email forwarded!');
- })
- .catch(error => {
- console.error('Email forwarding failed:', error.response.body);
- res.status(500).send('Email forwarding failed!');
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement