annotate src/index.html @ 8:f35ce99118ad

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 15 Sep 2024 10:48:05 -0600
parents ecc665c507b5
children 14932af93327
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 <!doctype html>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 <html>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 <head>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 <meta name="viewport" content="width=device-width, initial-scale=1">
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 <style>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 @import "/site.css";
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 h1 {
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 margin-bottom: 8px;
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 }
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 h4 {
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 margin-top: 0;
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 }
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 textarea {
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 width: 100%;
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 }
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 textarea[name=server] {
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 height: 120px;
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 }
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 textarea[name=mail] {
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22 height: 260px;
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 }
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 </style>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 <script>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 let server = {
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
27 host: 'mail.smtp2go.com',
5
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
28 port: 465,
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
29 username: 'reactionary',
0
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
30 password: 'not telling',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
31 };
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
32 server = JSON.stringify(server,null,'\t');
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
33
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
34 let mails = {};
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
35
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
36 mails.simple = {
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
37 From: 'mailer@reactionary.software',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
38 To: 'someone@reactionary.software',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
39 Subject: 'Simple',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
40 body: 'Google sucks.',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
41 };
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
42
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
43 mails.html = {
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
44 From: 'mailer@reactionary.software',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
45 To: 'someone@reactionary.software',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
46 Subject: 'HTML',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
47 'Content-Type': 'multipart/alternative',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
48 body: [
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
49 {
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
50 'Content-Type': 'text/plain; charset="UTF-8"',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
51 body: 'Google sucks.',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
52 },
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
53 {
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
54 'Content-Type': 'text/html; charset="UTF-8"',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
55 body: '<a href="https://www.google.com/">Google</a> sucks.',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
56 },
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
57 ],
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
58 };
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
59
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
60 mails.attachment = {
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
61 From: 'mailer@reactionary.software',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
62 To: 'someone@reactionary.software',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
63 Subject: 'Attachment',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
64 'Content-Type': 'multipart/mixed',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
65 body: [
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
66 {
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
67 'Content-Type': 'multipart/alternative',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
68 body: [
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
69 {
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
70 'Content-Type': 'text/plain; charset="UTF-8"',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
71 body: 'Google sucks.',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
72 },
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
73 {
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
74 'Content-Type': 'text/html; charset="UTF-8"',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
75 body: '<a href="https://www.google.com/">Google</a> sucks.',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
76 },
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
77 ],
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
78 },
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
79 {
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
80 'Content-Disposition': 'attachment; filename="test.txt"',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
81 body: 'test file',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
82 },
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
83 ]
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
84 };
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
85
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
86 function set(what) {
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
87 let s = JSON.stringify( mails[what], null, '\t' );
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
88 document.querySelector('textarea[name=mail]').textContent = s;
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
89 }
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
90
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
91 function init() {
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
92 document.querySelector('textarea[name=server]').textContent = server;
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
93 set('simple');
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
94 }
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
95 </script>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
96 <title>Mailer REST API</title>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
97 </head>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
98 <body>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
99 <h1>Mailer REST API</h1>
7
Franklin Schmidt <fschmidt@gmail.com>
parents: 6
diff changeset
100 <h4><a href="https://www.reactionary.software/">Reactionary Software</a> by <a href="https://linkmy.style/fschmidt">fschmidt</a></h4>
0
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
101
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
102 <p>Send emails by a POST request.</p>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
103
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
104 <form method=post action="/send.json">
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
105 <p>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
106 SMTP Server<br>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
107 <textarea name=server></textarea><br>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
108 <small>Update to your server.</small>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
109 </p>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
110 <p>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
111 Mail<br>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
112 <textarea name=mail></textarea><br>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
113 <button type=button onclick="set('simple')">Simple</button>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
114 <button type=button onclick="set('html')">HTML</button>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
115 <button type=button onclick="set('attachment')">Attachment</button>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
116 </p>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
117 <p>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
118 <input type=submit>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
119 </p>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
120 </form>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
121
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
122 <p>Note that all <b>mail</b> fields except <b>body</b> are simply passed directly to SMTP.</p>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
123
3
055db6736fc9 explain ports
Franklin Schmidt <fschmidt@gmail.com>
parents: 2
diff changeset
124 <p>Port 465 uses SSL. Other ports are unencrypted. If anyone can give me good reason why TLS or STARTTLS are needed, I can implement them.</p>
055db6736fc9 explain ports
Franklin Schmidt <fschmidt@gmail.com>
parents: 2
diff changeset
125
8
Franklin Schmidt <fschmidt@gmail.com>
parents: 7
diff changeset
126 <p>Here is <a href="https://hg.reactionary.software/repo/mailer/">the source</a> of this website. This service is implemented in <a href="https://www.luan.software/">Luan</a>. The entire implemention is in the file <a href="/send.json.luan">send.json.luan</a>. And here is <a href="https://mikraite.arkian.net/Mailer-REST-API-tp3435.html">a discussion thread</a> if you want to comment.</p>
0
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
127 </body>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
128 <script> init(); </script>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
129 </html>