| 0 | 1 <!doctype html> | 
|  | 2 <html> | 
|  | 3 	<head> | 
|  | 4 		<meta name="viewport" content="width=device-width, initial-scale=1"> | 
|  | 5 		<style> | 
|  | 6 			@import "/site.css"; | 
|  | 7 | 
|  | 8 			h1 { | 
|  | 9 				margin-bottom: 8px; | 
|  | 10 			} | 
|  | 11 			h4 { | 
|  | 12 				margin-top: 0; | 
|  | 13 			} | 
|  | 14 | 
|  | 15 			textarea { | 
|  | 16 				width: 100%; | 
|  | 17 			} | 
|  | 18 			textarea[name=server] { | 
|  | 19 				height: 120px; | 
|  | 20 			} | 
|  | 21 			textarea[name=mail] { | 
|  | 22 				height: 260px; | 
|  | 23 			} | 
|  | 24 		</style> | 
|  | 25 		<script> | 
|  | 26 			let server = { | 
|  | 27 				host: 'mail.smtp2go.com', | 
|  | 28 				username: 'luan.software', | 
|  | 29 				password: 'not telling', | 
|  | 30 				port: 2525, | 
|  | 31 			}; | 
|  | 32 			server = JSON.stringify(server,null,'\t'); | 
|  | 33 | 
|  | 34 			let mails = {}; | 
|  | 35 | 
|  | 36 			mails.simple = { | 
|  | 37 				From: 'mailer@reactionary.software', | 
|  | 38 				To: 'someone@reactionary.software', | 
|  | 39 				Subject: 'Simple', | 
|  | 40 				body: 'Google sucks.', | 
|  | 41 			}; | 
|  | 42 | 
|  | 43 			mails.html = { | 
|  | 44 				From: 'mailer@reactionary.software', | 
|  | 45 				To: 'someone@reactionary.software', | 
|  | 46 				Subject: 'HTML', | 
|  | 47 				'Content-Type': 'multipart/alternative', | 
|  | 48 				body: [ | 
|  | 49 					{ | 
|  | 50 						'Content-Type': 'text/plain; charset="UTF-8"', | 
|  | 51 						body: 'Google sucks.', | 
|  | 52 					}, | 
|  | 53 					{ | 
|  | 54 						'Content-Type': 'text/html; charset="UTF-8"', | 
|  | 55 						body: '<a href="https://www.google.com/">Google</a> sucks.', | 
|  | 56 					}, | 
|  | 57 				], | 
|  | 58 			}; | 
|  | 59 | 
|  | 60 			mails.attachment = { | 
|  | 61 				From: 'mailer@reactionary.software', | 
|  | 62 				To: 'someone@reactionary.software', | 
|  | 63 				Subject: 'Attachment', | 
|  | 64 				'Content-Type': 'multipart/mixed', | 
|  | 65 				body: [ | 
|  | 66 					{ | 
|  | 67 						'Content-Type': 'multipart/alternative', | 
|  | 68 						body: [ | 
|  | 69 							{ | 
|  | 70 								'Content-Type': 'text/plain; charset="UTF-8"', | 
|  | 71 								body: 'Google sucks.', | 
|  | 72 							}, | 
|  | 73 							{ | 
|  | 74 								'Content-Type': 'text/html; charset="UTF-8"', | 
|  | 75 								body: '<a href="https://www.google.com/">Google</a> sucks.', | 
|  | 76 							}, | 
|  | 77 						], | 
|  | 78 					}, | 
|  | 79 					{ | 
|  | 80 						'Content-Disposition': 'attachment; filename="test.txt"', | 
|  | 81 						body: 'test file', | 
|  | 82 					}, | 
|  | 83 				] | 
|  | 84 			}; | 
|  | 85 | 
|  | 86 			function set(what) { | 
|  | 87 				let s = JSON.stringify( mails[what], null, '\t' ); | 
|  | 88 				document.querySelector('textarea[name=mail]').textContent = s; | 
|  | 89 			} | 
|  | 90 | 
|  | 91 			function init() { | 
|  | 92 				document.querySelector('textarea[name=server]').textContent = server; | 
|  | 93 				set('simple'); | 
|  | 94 			} | 
|  | 95 		</script> | 
|  | 96 		<title>Mailer REST API</title> | 
|  | 97 	</head> | 
|  | 98 	<body> | 
|  | 99 		<h1>Mailer REST API</h1> | 
|  | 100 		<h4><a href="http://www.reactionary.software/">Reactionary Software</a> by <a href="https://www.linkmystyle.com/fschmidt">fschmidt</a></h4> | 
|  | 101 | 
|  | 102 		<p>Send emails by a POST request.</p> | 
|  | 103 | 
|  | 104 		<form method=post action="/send.json"> | 
|  | 105 			<p> | 
|  | 106 				SMTP Server<br> | 
|  | 107 				<textarea name=server></textarea><br> | 
|  | 108 				<small>Update to your server.</small> | 
|  | 109 			</p> | 
|  | 110 			<p> | 
|  | 111 				Mail<br> | 
|  | 112 				<textarea name=mail></textarea><br> | 
|  | 113 				<button type=button onclick="set('simple')">Simple</button> | 
|  | 114 				<button type=button onclick="set('html')">HTML</button> | 
|  | 115 				<button type=button onclick="set('attachment')">Attachment</button> | 
|  | 116 			</p> | 
|  | 117 			<p> | 
|  | 118 				<input type=submit> | 
|  | 119 			</p> | 
|  | 120 		</form> | 
|  | 121 | 
|  | 122 		<p>Note that all <b>mail</b> fields except <b>body</b> are simply passed directly to SMTP.</p> | 
|  | 123 | 
|  | 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> | 
|  | 125 	</body> | 
|  | 126 	<script> init(); </script> | 
|  | 127 </html> |