101 lines
No EOL
3.4 KiB
HTML
101 lines
No EOL
3.4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<title>🍪CookieMailer</title>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
<meta name="description" content="" />
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
|
|
<meta name="theme-color" content="">
|
|
<link rel="stylesheet" type="text/css" href="/static/css/mail.css" />
|
|
<script src="https://cdn.tiny.cloud/1/{{MCE_API_KEY}}/tinymce/5/tinymce.min.js" referrerpolicy="origin"></script></head>
|
|
<body>
|
|
<div id="loader"></div>
|
|
<div class="container">
|
|
<div class="row">
|
|
<div id="root" class="col">
|
|
<h2>🍪CookieMailer</h2>
|
|
<label for="recipients">To: </label>
|
|
<br/>
|
|
<select id="recipients" name="recipients">
|
|
<option value="admin">Test Email (SysAdmin)</option>
|
|
<option value="org">Test Email (Organizers)</option>
|
|
<!-- <option value="wpi">WPI Only</option> -->
|
|
<option value="all">All Participants ({{NUM_HACKERS}})</option>
|
|
</select>
|
|
<br/>
|
|
<label for="subject">Subject: </label>
|
|
<br/>
|
|
<input id="subject" name="subject" width="100%" type="text" value="Hack@WPI" />
|
|
<br/>
|
|
<br/>
|
|
<textarea id="content" name="content">
|
|
Message
|
|
<br/>
|
|
<br/>
|
|
Best,<br/>
|
|
<b>Hack@WPI Team</b><br/>
|
|
<i><a href="mailto:hack@wpi.edu">hack@wpi.edu</a></i><br/>
|
|
<img height="75px" width="75px" src="https://media.discordapp.net/attachments/829437603291856938/930311998057635880/hack317-min.png">
|
|
</textarea>
|
|
<br/>
|
|
<br/>
|
|
<input type="button" onClick="send()" value="Send"/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js" crossorigin="anonymous"></script>
|
|
<script type="text/javascript">
|
|
window.onload = function(){
|
|
tinymce.init({
|
|
selector: '#content',
|
|
plugins: 'advlist,link'
|
|
});
|
|
|
|
setTimeout(function(){
|
|
document.getElementById("loader").remove();
|
|
},1000);
|
|
};
|
|
|
|
function send() {
|
|
let rec = document.getElementById("recipients").value;
|
|
let subject = document.getElementById("subject").value;
|
|
let text = tinyMCE.activeEditor.getContent({ format: 'text' });
|
|
let html = tinyMCE.activeEditor.getContent({ format: 'html' });
|
|
|
|
let body = {
|
|
"recipients": rec,
|
|
"subject": subject,
|
|
"text": text,
|
|
"html": html
|
|
}
|
|
|
|
console.log("Sending Email:"+JSON.stringify(body))
|
|
|
|
const headers = [
|
|
["Content-Type", "application/json"],
|
|
];
|
|
|
|
if((rec != "all" && window.confirm("Send test email?")) || (rec == "all" && window.confirm("Send email to {{NUM_HACKERS}} recipients?"))) {
|
|
fetch('/send', {method: 'POST', body: JSON.stringify(body), headers: headers}).then(async (res) => {
|
|
window.alert(await res.text());
|
|
}).catch((err) => {
|
|
window.alert("Error sending message - see console for details");
|
|
console.log(err);
|
|
});
|
|
} else {
|
|
window.alert("Nothing was sent");
|
|
}
|
|
|
|
// fetch('/send', {method: 'POST', body: JSON.stringify(body), headers: headers}).then(async (res) => {
|
|
// alert("Message sent");
|
|
// document.body.innerHTML = await res.text()
|
|
// }).catch((err) => {
|
|
// alert("Error sending message");
|
|
// document.body.innerHTML = err;
|
|
// })
|
|
}
|
|
</script>
|
|
</body>
|
|
|
|
</html> |