Subject: 24.5; message-mode sends arbitrarily long headers

From: David Bremner <[email-masked]>
Date: Fri, 02 Oct 2015 21:41:07 -0300

1) run emacs -Q
2) M-x message-mail
3) insert a long header; "X-Stupid: " followed by the first 900 words in /usr/share/dict/words.
4) C-c C-c
5) select 'transport'

Now is the tricky part. You need to observe what actually hits the mail
transport. In my case I use a nullmailer transport with the ability to
log the complete message. At least for me, the header is unwrapped. This
causes messages to rejected by MTAs with strict adherence to RFC5322
section 2.1.1 which states a 998 character absolute limit on line length.

One could argue that this is user error/perversity, but it arrises
rather easily with References headers, and these are hidden by default,
so the user has no real clue there is a problem.

In GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.16.6)
 of 2015-09-19 on trouble, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11702000
System Description:	Debian GNU/Linux testing (stretch)

Configured using:
 `configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
 --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat
 -Werror=format-security -Wall' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-z,relro'

Important settings:
  value of $LANG: en_CA.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Mark set
Replaced 896 occurrences
scroll-down-command: Beginning of buffer
Mark set
Sending...
Mark set [2 times]
Sending via mail...
Setting `send-mail-function' temporarily since "emacs -q" would overwrite customizations
Sending...done
Making completion list...

Load-path shadows:
None found.

Features:
(shadow emacsbug mailalias cus-edit cus-start cus-load wid-edit
cl-loaddefs cl-lib sendmail mail-extr sort help-mode gnus-util message
format-spec rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mm-util help-fns
mail-prsvr mailabbrev mail-utils gmm-utils mailheader time-date tooltip
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
lisp-mode prog-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind gfilenotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 125836 18133)
 (symbols 48 19411 0)
 (miscs 40 72 200)
 (strings 32 13690 4848)
 (string-bytes 1 388741)
 (vectors 16 10803)
 (vector-slots 8 398787 10342)
 (floats 8 77 346)
 (intervals 56 3885 779)
 (buffers 960 15)
 (heap 1024 31763 882))