// Copyright (c) 2016 - 2017, Marcel Kapfer (mmk2410). // MIT License import 'dart:convert'; import 'dart:html'; void main() { // send mail listener querySelector("#send").onClick.listen(sendMail); } void sendMail(MouseEvent event) { InputElement title = querySelector("#mailtitle"); InputElement text = querySelector("#mailtext"); InputElement filename = querySelector("#filename"); InputElement addresslist = querySelector("#address_list"); CheckboxInputElement nofile = querySelector("#nofile"); Map data = { "title": title.value, "body": text.value, "filename": filename.value, "list": addresslist.value, "nofile": nofile.checked }; String url = "res/php/sendmail.php?data=${JSON.encode(data)}"; HttpRequest.getString(url).then((response) { if (response == "0") { window.alert("Mails successfully sent."); } else { window.alert("Failed to send mail."); } }); }