mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
30 lines
720 B
JavaScript
30 lines
720 B
JavaScript
export default {
|
|
useContext: ["mailTransporter"],
|
|
middlewares: ["withAuthentication"],
|
|
fn: async (req, res) => {
|
|
req.body = await req.urlencoded()
|
|
|
|
const { to, subject, body } = req.body
|
|
|
|
const mailOptions = {
|
|
from: "comty_no_reply@ragestudio.net",
|
|
to: to,
|
|
subject: subject,
|
|
text: body
|
|
}
|
|
|
|
console.log(mailOptions)
|
|
|
|
console.log(`Sending email to ${to}...`)
|
|
|
|
const result = await this.default.contexts.mailTransporter.sendMail(mailOptions)
|
|
|
|
console.log("Email sent! >", result)
|
|
|
|
return res.json({
|
|
code: 0,
|
|
message: "ok",
|
|
result: result
|
|
})
|
|
}
|
|
} |