emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 77bbca8 2/5: Fill too long mail headers


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 77bbca8 2/5: Fill too long mail headers
Date: Thu, 26 Jan 2017 22:12:40 +0000 (UTC)

branch: master
commit 77bbca8c82f6e553c42abbfafca28f55fc995d00
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Fill too long mail headers
    
    * lisp/gnus/message.el (message--fold-long-headers): New
    function to fold too-long headers (bug#21608).
    (message-send-mail): Use it to fill headers longer than 998
    characters (which is the protocol limit).
---
 lisp/gnus/message.el |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 50d2380..e45ab10 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -4552,6 +4552,9 @@ This function could be useful in `message-setup-hook'."
            (forward-line 1)
            (unless (y-or-n-p "Send anyway? ")
              (error "Failed to send the message")))))
+      ;; Fold too-long header lines.  They should be no longer than
+      ;; 998 octets long.
+      (message--fold-long-headers)
       ;; Let the user do all of the above.
       (run-hooks 'message-header-hook))
     (setq options message-options)
@@ -4648,6 +4651,14 @@ If you always want Gnus to send messages in one piece, 
set
     (setq message-options options)
     (push 'mail message-sent-message-via)))
 
+(defun message--fold-long-headers ()
+  (goto-char (point-min))
+  (while (not (eobp))
+    (when (and (looking-at "[^:]+:")
+              (> (- (line-end-position) (point)) 998))
+      (mail-header-fold-field))
+    (forward-line 1)))
+
 (defvar sendmail-program)
 (defvar smtpmail-smtp-server)
 (defvar smtpmail-smtp-service)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]