Mails send separatly. Input text used.

Res T123,T124
This commit is contained in:
Marcel Kapfer (mmk2410) 2016-11-20 08:47:12 +01:00
parent 199a89a8d4
commit a3c02b057d
8 changed files with 129 additions and 37 deletions

23
res/dart/.gitignore vendored Normal file
View file

@ -0,0 +1,23 @@
# Files and directories created by pub
.packages
.pub/
build/
packages
# Remove the following pattern if you wish to check in your lock file
pubspec.lock
# Files created by dart2js
*.dart.js
*.part.js
*.js.deps
*.js.map
*.info.json
# Directory created by dartdoc
doc/api/
# JetBrains IDEs
.idea/
*.iml
*.ipr
*.iws

34
res/dart/main.dart Normal file
View file

@ -0,0 +1,34 @@
// Copyright (c) 2016, 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");
Map data = {
"title": title.value,
"body": text.value,
"filename": filename.value,
"list": addresslist.value
};
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.");
}
});
}