Explanation in my comment...
const transporter = nodemailer.createTransport({
host: "smtp.ionos.de",
port: 587,
secure: false, // true for port 465, false for other ports
auth: {
user: "[email protected]",
pass: "xxxxxxxxxxxxxx",
},
});
general_users.post("/Kontakt", async(req, res, next) => {
var content = req.body;
content = JSON.stringify(content)
await transporter.sendMail({
from: "[email protected]", // sender address
to: "[email protected]", // list of receivers
subject: "Kundenanfrage", // Subject line
text: content, // plain text body
html: `<b>${content}</b>`})
.catch((error) => {return res.status(500).json({ error: "message not sent" }).end();})
.then(res.status(200).json({ message: "message sent" }).end())
})