Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

use Postmark broadcast stream

Steven Teybe72d3b80840
diff --git a/emails/BelatedWelcome.tsx b/emails/BelatedWelcome.tsx
new file mode 100644
index 0000000000..a47512943f
--- /dev/null
+++ b/emails/BelatedWelcome.tsx
@@ -0,0 +1,132 @@
+import Head from "./components/Head";
+import Header from "./components/Header";
+import Footer from "./components/Footer";
+import Divider from "./components/Divider";
+import {
+ Mjml,
+ MjmlBody,
+ MjmlSection,
+ MjmlColumn,
+ MjmlText,
+ MjmlWrapper,
+ MjmlImage,
+} from "mjml-react";
+import { grayDark, purple } from "./components/theme";
+
+export default function WelcomeEmail({
+ domains,
+}: {
+ domains?: string[];
+}): JSX.Element {
+ return (
+ <Mjml>
+ <Head />
+ <MjmlBody width={500}>
+ <MjmlWrapper cssClass="container">
+ <Header title="A Belated Welcome to Dub" />
+ <MjmlSection padding="0">
+ <MjmlColumn>
+ <MjmlImage
+ cssClass="hero"
+ padding="0"
+ align="left"
+ src="https://raw.githubusercontent.com/steven-tey/dub/main/public/static/thumbnail.png"
+ />
+ </MjmlColumn>
+ </MjmlSection>
+ <MjmlSection cssClass="smooth">
+ <MjmlColumn>
+ <MjmlText cssClass="paragraph">
+ Welcome to Dub - the open-source Bitly alternative!
+ </MjmlText>
+ <MjmlText cssClass="paragraph">
+ Apologies for the belated welcome message - I just{" "}
+ <a
+ href="https://twitter.com/steventey/status/1579471673325408257"
+ target="_blank"
+ >
+ got transactional emails working
+ </a>{" "}
+ this weekend.
+ </MjmlText>
+ {domains ? (
+ <MjmlText cssClass="paragraph">
+ I noticed that you've been successfully using Dub with your
+ custom domain
+ {domains.length > 1 ? "s" : ""}{" "}
+ {domains.map((domain) => (
+ <span key={domain}>
+ <code>
+ <a
+ rel="nofollow"
+ style={{
+ textDecoration: "none",
+ color: `${purple} !important`,
+ }}
+ >
+ {domain}
+ </a>
+ </code>
+ {", "}
+ </span>
+ ))}{" "}
+ and I wanted to reach out to ask if you have any feedback or
+ suggestions for Dub? I'd love to hear from you!
+ </MjmlText>
+ ) : (
+ <MjmlText cssClass="paragraph">
+ I noticed that you recently signed up for Dub but haven't
+ successfully connected a custom domain yet, and I wanted to
+ reach out to ask if you have any questions about that?
+ </MjmlText>
+ )}
+ <MjmlText cssClass="paragraph">
+ In case you missed it, I also revamped our pricing model and
+ made it more affordable for everyone. You can read more about it{" "}
+ <a
+ href="https://twitter.com/dubdotsh/status/1579466952594292737"
+ target="_blank"
+ >
+ here
+ </a>
+ .
+ </MjmlText>
+ <MjmlText cssClass="paragraph">
+ If you haven't already, here are a few more things you can do:
+ </MjmlText>
+ <MjmlText cssClass="li">
+ •&nbsp;&nbsp;Follow us on{" "}
+ <a href="https://twitter.com/dubdotsh/" target="_blank">
+ Twitter
+ </a>
+ </MjmlText>
+ <MjmlText cssClass="li">
+ •&nbsp;&nbsp;Star the repo on{" "}
+ <a href="https://github.com/steven-tey/dub" target="_blank">
+ GitHub
+ </a>
+ </MjmlText>
+ {domains ? (
+ <MjmlText cssClass="paragraph" color={grayDark}>
+ P.S.: You'll receive an email from Trustpilot in the next
+ couple of days - if you enjoyed using Dub, it would mean a lot
+ if you could leave a review; if not, I'd love to hear what I
+ can do to improve Dub!
+ </MjmlText>
+ ) : (
+ <MjmlText cssClass="paragraph">
+ Looking forward to hearing from you!
+ </MjmlText>
+ )}
+ <MjmlText cssClass="paragraph" color={grayDark}>
+ Steven from Dub
+ </MjmlText>
+ <Divider />
+ </MjmlColumn>
+ </MjmlSection>
+ <Footer unsubscribe />
+ </MjmlWrapper>
+ </MjmlBody>
+ </Mjml>
+ );
+}
diff --git a/emails/index.ts b/emails/index.ts
index b1624c4637..6807591e35 100644
--- a/emails/index.ts
+++ b/emails/index.ts
@@ -1,20 +1,16 @@
import nodemailer from "nodemailer";
import { buildSendMail } from "mailing-core";
-const transportConfig = {
- port: 587,
- auth: {
- user: process.env.POSTMARK_API_KEY,
- pass: process.env.POSTMARK_API_KEY,
- },
-};
-
const sendMail = buildSendMail({
transport: nodemailer.createTransport({
host: "smtp.postmarkapp.com",
- ...transportConfig,
+ port: 587,
+ auth: {
+ user: process.env.POSTMARK_API_KEY,
+ pass: process.env.POSTMARK_API_KEY,
+ },
}),
- defaultFrom: "Dub <[email protected]>",
+ defaultFrom: "Steven from Dub <[email protected]>",
configPath: "./mailing.config.json",
});
@@ -23,8 +19,12 @@ export default sendMail;
export const sendMarketingMail = buildSendMail({
transport: nodemailer.createTransport({
host: "smtp-broadcasts.postmarkapp.com",
- ...transportConfig,
+ port: 587,
+ auth: {
+ user: process.env.POSTMARK_MARKETING_API_KEY,
+ pass: process.env.POSTMARK_MARKETING_API_SECRET,
+ },
}),
- defaultFrom: "Steven from Dub <[email protected]>",
+ defaultFrom: "Steven from Dub <[email protected]>",
configPath: "./mailing.config.json",
});
diff --git a/emails/previews/Sequences.tsx b/emails/previews/Sequences.tsx
new file mode 100644
index 0000000000..e5d178fed8
--- /dev/null
+++ b/emails/previews/Sequences.tsx
@@ -0,0 +1,5 @@
+import { default as BelatedWelcomeEmail } from "../BelatedWelcome";
+
+export function BelatedWelcome() {
+ return <BelatedWelcomeEmail />;
+}
diff --git a/lib/cron/domains.tsx b/lib/cron/domains.tsx
index 5986c36477..a5427f1b2b 100644
--- a/lib/cron/domains.tsx
+++ b/lib/cron/domains.tsx
@@ -56,7 +56,6 @@ export const handleDomainUpdates = async (
sendMail({
subject: `Your project ${projectSlug} has been deleted`,
to: ownerEmail,
- from: "Steven from Dub <[email protected]>",
component: (
<ProjectDeleted domain={domain} projectSlug={projectSlug} />
),
@@ -83,7 +82,6 @@ const sendDomainInvalidEmail = async (
sendMail({
subject: `Your domain ${domain} needs to be configured`,
to: ownerEmail,
- from: "Steven from Dub <[email protected]>",
component: (
<InvalidDomain
domain={domain}
diff --git a/lib/cron/usage.tsx b/lib/cron/usage.tsx
index d6a37f8c8d..e2376b62f9 100644
--- a/lib/cron/usage.tsx
+++ b/lib/cron/usage.tsx
@@ -139,7 +139,6 @@ const sendUsageLimitEmail = async (
sendMail({
subject: `You have exceeded your Dub usage limit`,
to: email,
- from: "Steven from Dub <[email protected]>",
component: (
<UsageExceeded usage={usage} usageLimit={usageLimit} type={type} />
),