annotate src/index.html @ 0:bd4802730bab

its working
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 18 May 2023 21:20:59 -0600
parents
children 6cd68fe047c7
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',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
28 username: 'luan.software',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
29 password: 'not telling',
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
30 port: 2525,
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>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
100 <h4><a href="http://www.reactionary.software/">Reactionary Software</a> by <a href="https://www.linkmystyle.com/fschmidt">fschmidt</a></h4>
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
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
124 <p>Here is <a href="https://hg.reactionary.software/repo/mailer/">the source</a> of this website. This service is implemented in <a href="http://www.luan.software/">Luan</a>. The entire implemention is in the file <a href="/send.json.luan">send.json.luan</a>. And here are discussion threads on <a href="https://communities.win/c/programming/p/16b6N5KIjr/mailer-rest-api/c">Scored</a> and <a href="http://www.mikraite.org/Mailer-REST-API-tp3435.html">Reactionary Software</a> if you want to comment.</p>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
125 </body>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
126 <script> init(); </script>
bd4802730bab its working
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
127 </html>