Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3396298
D4291.id14186.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D4291.id14186.diff
View Options
diff --git a/keyserver/src/emails/sendmail.js b/keyserver/src/emails/sendmail.js
--- a/keyserver/src/emails/sendmail.js
+++ b/keyserver/src/emails/sendmail.js
@@ -1,7 +1,10 @@
// @flow
+import invariant from 'invariant';
import nodemailer from 'nodemailer';
+import { importJSON } from '../utils/import-json.js';
+
type MailInfo = {
+from: string,
+to: string,
@@ -14,6 +17,26 @@
...
};
-const sendmail: Transport = nodemailer.createTransport({ sendmail: true });
+type PostmarkConfig = {
+ +apiToken: string,
+};
+
+async function getSendmail(): Promise<Transport> {
+ const postmark: ?PostmarkConfig = await importJSON({
+ folder: 'facts',
+ name: 'postmark',
+ });
+ invariant(postmark, 'Postmark config missing');
+ return nodemailer.createTransport({
+ host: 'smtp.postmarkapp.com',
+ port: 587,
+ secure: false,
+ auth: {
+ user: postmark.apiToken,
+ pass: postmark.apiToken,
+ },
+ requireTLS: true,
+ });
+}
-export default sendmail;
+export default getSendmail;
diff --git a/keyserver/src/emails/subscribe-email-updates.js b/keyserver/src/emails/subscribe-email-updates.js
--- a/keyserver/src/emails/subscribe-email-updates.js
+++ b/keyserver/src/emails/subscribe-email-updates.js
@@ -6,7 +6,7 @@
import ashoat from 'lib/facts/ashoat';
import type { EmailSubscriptionRequest } from 'lib/types/account-types';
-import sendmail from './sendmail';
+import getSendmail from './sendmail';
import Template from './template.react';
async function sendEmailSubscriptionRequestToAshoat(
@@ -22,8 +22,9 @@
);
const html = renderEmail(email);
+ const sendmail = await getSendmail();
await sendmail.sendMail({
- from: 'no-reply@squadcal.org',
+ from: 'no-reply@comm.app',
to: ashoat.landing_email,
subject: title,
html,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 2, 11:38 AM (17 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2607451
Default Alt Text
D4291.id14186.diff (1 KB)
Attached To
Mode
D4291: [keyserver] Use SMTP (via Postmark) instead of `sendmail` for email subscriptions
Attached
Detach File
Event Timeline
Log In to Comment