Initial commit
This commit is contained in:
26
pages/api/hello.js
Normal file
26
pages/api/hello.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import nodemailer from "nodemailer";
|
||||
|
||||
export default function handler(req, res) {
|
||||
let transporter = nodemailer.createTransport({
|
||||
host: "mail.wastpol.pl",
|
||||
port: 465,
|
||||
secure: true,
|
||||
auth: {
|
||||
user: "kontakt@wastpol.pl",
|
||||
pass: "jHP4oCaELy0EOhz5",
|
||||
},
|
||||
});
|
||||
|
||||
let info = transporter.sendMail({
|
||||
from: `"${req.body.name} 🤡" <foo@example.com>`, // sender address
|
||||
to: "kontakt@wastpol.pl", // list of receivers
|
||||
subject: `Wiadomość od ${req.body.name}`, // Subject line
|
||||
html: `<b>Treść:</b> ${req.body.msg}<br/>
|
||||
<b>Dane do kontaktu:</b><br/>
|
||||
<b>nr tel: </b>${req.body.tel}<br/>
|
||||
<b>mail: </b>${req.body.mail}<br/><br/>
|
||||
<i>Wiadomość wygenerowana automatycznie na stronie wastpol.pl</i>`, // html body
|
||||
});
|
||||
|
||||
res.status(200).json({ msg: "Message Sent" });
|
||||
}
|
||||
Reference in New Issue
Block a user