-
Notifications
You must be signed in to change notification settings - Fork 0
/
mailinglist.ts
102 lines (80 loc) · 3.15 KB
/
mailinglist.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import dotenv from 'dotenv';
import readline from 'readline';
import Mailgun from 'mailgun-js';
import { stripIndent } from 'common-tags';
dotenv.config();
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const { MAILGUN_API_KEY } = process.env;
const mailgun = Mailgun({ apiKey: MAILGUN_API_KEY!, domain: 'hakatashi.com' });
(async () => {
const text = stripIndent`
Note: This email is being sent to users who have registered for previous TSG CTFs. If you wish to unsubscribe, visit %mailing_list_unsubscribe_url%
Hello hackers. After two years of silence, we are back. If you enjoyed the previous TSG CTF, this is good news!
We are pleased to announce that TSG CTF 2023 will be held this weekend from 07:00 on November 4th to 07:00 on November 5th (UTC). This time as well, we are putting a lot of effort into reviews and making sure that challenges are published in the best possible way.
Also, it's worth mentioning that the top hackers will be rewarded by dollars. Sponsored by Flatt Security, Inc., the prizes are as follows: 1st place receives 1,000 USD, 2nd place 500 USD, and 3rd place 200 USD.
The scoreboard is ready. Register now!
https://score.ctf.tsg.ne.jp/
Sincerely,
Koki Takahashi (@hakatashi), a leader of team TSG
`;
const html = stripIndent`
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="text-align: center;">
<img src="https://score.ctf.tsg.ne.jp/themes/tsgctf/static/ogimage.jpg" alt="TSG CTF 2023" style="max-width: 600px;">
</td>
</tr>
</table>
<p>
Note: This email is being sent to users who have registered for previous TSG CTFs. If you wish to unsubscribe, click <a href="%mailing_list_unsubscribe_url%">here</a>.
</p>
<p>
Hello hackers. After two years of silence, we are back. If you enjoyed the previous TSG CTF, this is good news!
</p>
<p>
We are pleased to announce that TSG CTF 2023 will be held this weekend from 07:00 on November 4th to 07:00 on November 5th (UTC). This time as well, we are putting a lot of effort into reviews and making sure that challenges are published in the best possible way.
</p>
<p>
Also, it's worth mentioning that the top hackers will be rewarded by dollars. Sponsored by Flatt Security, Inc., the prizes are as follows: 1st place receives 1,000 USD, 2nd place 500 USD, and 3rd place 200 USD.
</p>
<p>
The scoreboard is ready. Register now!<br>
https://score.ctf.tsg.ne.jp/
</p>
<p>
Sincerely,<br>
Koki Takahashi (@hakatashi), a leader of team TSG
</p>
`;
console.log('HTML:');
console.log(html);
console.log('');
console.log('Text:');
console.log(text);
console.log('');
await new Promise<void>((resolve) => {
rl.question('Is this ok? [yN] ', (answer) => {
if (answer.toLowerCase() === 'y') {
rl.close();
resolve();
} else {
process.exit();
}
});
});
const mailResult = await new Promise((resolve) => {
mailgun.messages().send({
from: 'TSG <admin@tsg.ne.jp>',
to: 'tsgctf-announcements@hakatashi.com',
subject: 'Invitation to TSG CTF 2024',
text,
html,
}, (error, body) => {
resolve(body);
});
});
console.log(mailResult);
})();