From: NeilBrown Date: Fri, 28 Jul 2023 06:09:11 +0000 (+1000) Subject: compose-email: check for needed headers: X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=b997dbde1e0adf3f8e50531cc4f3270d183a6186;p=edlib.git compose-email: check for needed headers: Don't sent the messages unless there is at least - From: - Subject: - To: or Cc: Signed-off-by: NeilBrown --- diff --git a/DOC/TODO.md b/DOC/TODO.md index c6a18901..30160e90 100644 --- a/DOC/TODO.md +++ b/DOC/TODO.md @@ -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 diff --git a/python/lib-compose-email.py b/python/lib-compose-email.py index 2122a6cb..157e2279 100644 --- a/python/lib-compose-email.py +++ b/python/lib-compose-email.py @@ -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()