Как исправить отправку на почту?
if(!req.body.mail || !req.body.adres) return res.sendStatus(400)
const message = {
to: '<[email protected]>',
subject: 'Заказ',
text:`Заказ
данные:
почта: ${req.body.mail}
адрес: ${req.body.adres}
продукт: ${req.body.element_name}`
}
И есть такой код
if (productsStore.indexOf(id) !== -1) {
htmlCatalog += `
<tr>
<td class="shopping_element_name" name="element_name">${name}</td>
<td class="shopping_element_price">${price} ₽</td>
</tr>
`;
sumCatalog += price;
}
const html = `
<div class="shopping_cart">
<div class="shoppingClose" onclick="shoppingPage.handleCartHide();">
<span class="hideCartjs"></span>
<span class="hideCartjsTwo"></span>
<span class="hideCartNoneJs"></span>
</div>
<form method="POST" action="http://localhost:3001/gareg">
<table>
${htmlCatalog}
<tr>
<td class="shopping_element_name">Полная сумма:</td>
<td class="shopping_element_price" name="allprice">${sumCatalog} ₽</td>
</tr>
</table>
<input class="mailClient" name="mail" type="mail" placeholder="Введите свою почту..."
required/>
<input class="adress" name="adres" placeholder="Введите адрес доставки..." required/>
<div>
<button class="buyProduct" type="submit">Оформить</button>
</div>
</form>
</div>
`;
Не могу понять, как отправить ${name} продукта на почту.
На почте выдаёт: продукт: undefined.