diff --git a/index.html b/index.html index fa3e474..78ac29d 100755 --- a/index.html +++ b/index.html @@ -68,6 +68,7 @@

Change the text of the email if you want.

Title:

Text:

+

Send without file

Filename:

diff --git a/res/css/main.sass b/res/css/main.sass index b56bd8a..12df386 100755 --- a/res/css/main.sass +++ b/res/css/main.sass @@ -163,6 +163,12 @@ input.button .itextarea:focus @extend .itextfield +.icheckbox + margin: 0 + padding: 0 + margin-right: 10px + vertical-align: sub + /* FILESPREAD */ .edit_template diff --git a/res/dart/main.dart b/res/dart/main.dart index 91a437b..77c345f 100644 --- a/res/dart/main.dart +++ b/res/dart/main.dart @@ -1,4 +1,4 @@ -// Copyright (c) 2016, Marcel Kapfer (mmk2410). +// Copyright (c) 2016 - 2017, Marcel Kapfer (mmk2410). // MIT License import 'dart:convert'; @@ -14,12 +14,14 @@ void sendMail(MouseEvent event) { 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 + "list": addresslist.value, + "nofile": nofile.checked }; String url = "res/php/sendmail.php?data=${JSON.encode(data)}"; @@ -31,4 +33,5 @@ void sendMail(MouseEvent event) { window.alert("Failed to send mail."); } }); + } diff --git a/res/php/sendmail.php b/res/php/sendmail.php index 4720281..af9782a 100755 --- a/res/php/sendmail.php +++ b/res/php/sendmail.php @@ -21,6 +21,12 @@ function main($ini) { $filename = $data["filename"]; + $nofile = $data["nofile"]; + + if ($nofile) { + $filename = ""; + } + foreach ($addresses as $address) { if (sendMail($title, $content, $filename, $address, $ini) != 0) { print "-1"; @@ -46,7 +52,9 @@ function sendMail($title, $content, $filename, $address, $ini) { $mail->addReplyTo($ini["reply"]); } - $mail->AddAttachment("../../assets/file.bin", $filename); + if (!empty($filename)) { + $mail->AddAttachment("../../assets/file.bin", $filename); + } if (!$mail->Send()) { return -1;