]> git.neil.brown.name Git - edlib.git/commitdiff
compose-email: check for needed headers:
authorNeilBrown <neil@brown.name>
Fri, 28 Jul 2023 06:09:11 +0000 (16:09 +1000)
committerNeilBrown <neil@brown.name>
Fri, 28 Jul 2023 06:15:13 +0000 (16:15 +1000)
Don't sent the messages unless there is at least
 - From:
 - Subject:
 - To: or Cc:

Signed-off-by: NeilBrown <neil@brown.name>
DOC/TODO.md
python/lib-compose-email.py

index c6a189019a32353dcfcff660529de1ea8103fd60..30160e909639793c4406baac141a0580f8dda79c 100644 (file)
@@ -14,7 +14,7 @@ the file.
 - [X] How to run shell command in "44" window??
 - [X] In c-mode, if ) is at end of line then highlighting it causes the
       line to wrap
-- [ ] mail compose should refuse to submit email with no valid 'to' address
+- [X] mail compose should refuse to submit email with no valid 'to' address
 - [X] If a pane with shift-disabled has cursor past the right edge, the
       cursor gets positioned outside the window
 - [X] when find-file dialog shifts left, it doesn't shift back until
@@ -42,6 +42,7 @@ the file.
 - [X] change :A-x menu to use doc-list - add sorting
 - [ ] Change render-lines to handle centring and right-align in flush_line
 - [ ] Teach render-lines to pad spaces to left/right align text
+- [ ] revise *Welcome* page
 
 ### Small
 
index 2122a6cb3af6ae4b764a94001acc103ec5baa6f0..157e2279ec2246a8c69f789498be7f9a8ea9ee65 100644 (file)
@@ -806,6 +806,16 @@ class compose_email(edlib.Pane):
                 except:
                     pass
 
+        if not msg['from']:
+            self.call("Message", "No From: line in message - cannot send")
+            return edlib.Efail
+        if not msg['subject']:
+            self.call("Message", "No Subject: line in message - cannot send")
+            return edlib.Efail
+        if not msg['to'] and not msg['cc']:
+            self.call("Message", "No recipients (To: or Cc:) in message - cannot send")
+            return edlib.Efail
+
         # Look for attachments
         while m.next():
             s = m.next()