From 56f507c1ed551963f03f0ca86fd75c9c627f4504 Mon Sep 17 00:00:00 2001 From: James Wyndham Date: Wed, 10 Apr 2024 14:21:28 +0800 Subject: [PATCH] feature - first-purchase email --- .../bin/pb_hooks/emails/first-purchase.html | 302 ++++++++++++++++++ .../bin/pb_hooks/emails/first-purchase.mjml | 132 ++++++++ Backend/bin/pb_hooks/main.pb.js | 24 +- 3 files changed, 453 insertions(+), 5 deletions(-) create mode 100644 Backend/bin/pb_hooks/emails/first-purchase.html create mode 100644 Backend/bin/pb_hooks/emails/first-purchase.mjml diff --git a/Backend/bin/pb_hooks/emails/first-purchase.html b/Backend/bin/pb_hooks/emails/first-purchase.html new file mode 100644 index 0000000..1b13567 --- /dev/null +++ b/Backend/bin/pb_hooks/emails/first-purchase.html @@ -0,0 +1,302 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ +
+ + + + + + +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + +
+
Thanks For Purchasing
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + + + + + + + + + +
+
{{.firstName}} we are so excited to help you build your next million dollar SaaS!
+
+
Over the next 24 hours we're going to send you information about our prize winning SaaS tools we are using to help you build at 10x. When you are ready to start producing apps at max capacity click the button below.
+
+ + + + +
+ Learn More +
+
+
Thanks,
The {{.company}} Team
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + +
+ + + + + + +
+ + + + +
+ + + +
+
+ Web +
+ + + + + + +
+ + + + +
+ + + +
+
+ Github +
+ + + + + + +
+ + + + +
+ + + +
+
+ Youtube +
+ + + + + + +
+ + + + +
+ + + +
+
+ X +
+ +
+
+ +
+
+ +
+ + + \ No newline at end of file diff --git a/Backend/bin/pb_hooks/emails/first-purchase.mjml b/Backend/bin/pb_hooks/emails/first-purchase.mjml new file mode 100644 index 0000000..1d1f546 --- /dev/null +++ b/Backend/bin/pb_hooks/emails/first-purchase.mjml @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + Thanks For Purchasing + + + + + {{.firstName}} we are so excited to help you build your next million + dollar SaaS! + Over the next 24 hours we're going to send you information about + our prize winning SaaS + tools + we are using to help you build at 10x. When you are ready to start + producing apps at max capacity click the button below. + Learn More + Thanks,
+ The {{.company}} Team
+
+
+ + + + + Web + + + Github + + + Youtube + + + X + + + + +
+
diff --git a/Backend/bin/pb_hooks/main.pb.js b/Backend/bin/pb_hooks/main.pb.js index 9b8bc48..c222fbe 100644 --- a/Backend/bin/pb_hooks/main.pb.js +++ b/Backend/bin/pb_hooks/main.pb.js @@ -17,9 +17,23 @@ onRecordAfterCreateRequest((e) => { $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... + }); -routerAdd("GET", "/hello/:name", (c) => { - let name = c.pathParam("name"); - - return c.json(200, { message: "Hello " + name }); -}); + $app.newMailClient().send(message); +}, "subscription");