Quiz-PDF/Backend/bin/pb_hooks/main.pb.js

40 lines
1.2 KiB
JavaScript

onRecordAfterCreateRequest((e) => {
const message = new MailerMessage({
from: {
address: $app.settings().meta.senderAddress,
name: $app.settings().meta.senderName,
},
to: [{ address: e.record.email() }],
subject: "Are you ready to launch 10x faster?",
html: $template
.loadFiles(`${__hooks}/emails/signup.html`)
.render({
firstName: e.record.get("firstName"),
company: $app.settings().meta.appName,
}),
// bcc, cc and custom headers are also supported...
});
$app.newMailClient().send(message);
}, "user");
onRecordAfterCreateRequest((e) => {
const user = $app.dao().findRecordById("articles", e.record.get("user_id"))
const message = new MailerMessage({
from: {
address: $app.settings().meta.senderAddress,
name: $app.settings().meta.senderName,
},
to: [{ address: user.get("email") }],
subject: "Thanks For Purchasing!",
html: $template
.loadFiles(`${__hooks}/emails/signup.html`)
.render({
firstName: e.record.get("firstName"),
company: $app.settings().meta.appName,
}),
// bcc, cc and custom headers are also supported...
});
$app.newMailClient().send(message);
}, "subscription");