Subject: bug#38200: 26.2; sendmail.el needlessly munging headers by inserting backslashes

From: Ed Sabol <[email-masked]>
Date: Wed, 13 Nov 2019 16:51:08 -0500 (EST)

Steps:
1. Evaluate the following:
(setq mail-user-agent 'sendmail-user-agent)
(setq send-mail-function 'sendmail-send-it)
2. Hit `C-x m' or `M-x compose-mail'.
3. In the To: header type the following:

"LastName, FirstName I. (CODE-999.9)[CONTRACTOR COMPANY INC]"
	<[email-masked]>

except replace "[email-masked]" with your actual email address.

4. Put "test" in the Subject: header.
5. Add a "Bcc:" header with your actual email address.
6. In the body of the email, put "test".
7. Hit `C-c C-c' or `M-x mail-send' to send the email.

Result:
When you receive the sent email, the To: header of the email will look
like so:

"LastName\, FirstName I. \(CODE-999.9\)\[CONTRACTING COMPANY INC\]"
        <[email-masked]>

It should like like this:

"LastName, FirstName I. (CODE-999.9)[CONTRACTING COMPANY INC]"
        <[email-masked]>

At some point, something in sendmail.el changed between Emacs version
21.2 and 26.2 that resulted in these backslashes being
added. According to RFC822 and other email standards, these
backslashes are not needed. Emacs should not be modifying the headers
of emails needlessly.

In GNU Emacs 26.2 (build 2, x86_64-pc-linux-gnu, X toolkit)
 of 2019-04-12 built on heasarcdev
Windowing system distributor 'Scientific Linux', version 11.0.11704000
System Description:	Scientific Linux release 6.10 (Carbon)

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark set [2 times]
Sending...done

Configured using:
 'configure --prefix=/software/usr/contrib
 --exec-prefix=/software/usr/contrib/linux-6.x --with-x-toolkit=athena
 --with-toolkit-scroll-bars=no --with-jpeg=no --with-gif=no
 --with-tiff=no --with-gnutls=no'

Configured features:
XAW3D XPM PNG SOUND GSETTINGS GLIB NOTIFY LIBSELINUX LIBXML2 FREETYPE
XFT ZLIB LUCID X11 XDBE XIM THREADS

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-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
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow emacsbug message rmc puny seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs format-spec
rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config
gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader mailalias sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair
time-date mule-util tooltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core term/tty-colors frame cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet
lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese composite charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
minibuffer cl-preloaded 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
threads inotify dynamic-setting font-render-setting x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 95678 7833)
 (symbols 48 19846 1)
 (miscs 40 54 168)
 (strings 32 29174 958)
 (string-bytes 1 769837)
 (vectors 16 14705)
 (vector-slots 8 503996 12136)
 (floats 8 53 115)
 (intervals 56 272 0)
 (buffers 992 9)
 (heap 1024 28666 935))