Subject: 28.2; smtpmail-send-it fails when credentials stored in password-store

From: Manuel González <[email-masked]>
Date: Tue, 28 Feb 2023 21:04:54 +0000

Hello,

I have setup my computer to send email using a Protonmail account (using
proton-bridge package, which acts as a proxy in localhost). My email
client of choice is mu4e, which I have setup and configured to talk to
localhost making use of smtpmail, the following being the relevant configuration.

(setq smtpmail-smtp-user "<REDACTED>"
smtpmail-smtp-server "127.0.0.1"
smtpmail-stream-type 'starttls
smtpmail-smtp-service 1025)

Seemingly, I have setup auth-store [1] to use password-store:

(auth-source-pass-enable)
(setq auth-source-debug t)

I have then setup an entry in my password-store repository that matches
127.0.0.1:1025. When I attempt to send an email, auth-store debug logs
in Messages buffer tell me that the correct entry was matched, the entry
decrypted and used the credentials in "Netrc standard" as specified in
the documentation [2]
However, smtpmail-send-it fails with "invalid username or password in
response":

Debugger entered--Lisp error: (error "Sending failed: 454 4.7.0 invalid username or pass...")
error("Sending failed: %s" "454 4.7.0 invalid username or password in response...")
smtpmail-send-it()
message-multi-smtp-send-mail()
message--send-mail-maybe-partially()
message-send-mail(nil)
message-send-via-mail(nil)
message-send(nil)
message-send-and-exit(nil)
funcall-interactively(message-send-and-exit nil)
command-execute(message-send-and-exit)

Here the SMTP trace:

220 127.0.0.1 ESMTP Service Ready
250-Hello hecate
250-PIPELINING
250-8BITMIME
250-ENHANCEDSTATUSCODES
250-CHUNKING
250-STARTTLS
250-AUTH PLAIN LOGIN
250 SIZE
220 2.0.0 Ready to start TLS
250-Hello hecate
250-PIPELINING
250-8BITMIME
250-ENHANCEDSTATUSCODES
250-CHUNKING
250-AUTH PLAIN LOGIN
250 SIZE
AUTH PLAIN <omitted>
454 4.7.0 invalid username or password
QUIT
221 2.0.0 Bye

Process smtpmail connection broken by remote peer

Un-setting password-store as auth-store service and setting the contents of the
entry that is matched in a plain text file under ~/.authinfo will
succeed when attempting to send the email.

I have doubts over where to file this issue (if under mu4e or in Emacs),
and I am not sure if the problem is to be related to Jason Donenfeld's
wrapper for pass [3] or if it is a problem with smtpmail. Please, let me
know if I should direct this issue elsewhere.

Cheers,

-Manuel

[1] -https://www.gnu.org/software/emacs/manual/html_node/auth/The-Unix-password-store.html
[2] -https://www.gnu.org/software/emacs/manual/html_node/auth/Help-for-users.html#Help-for-users
[3] -https://git.zx2c4.com/password-store/tree/contrib/emacs/password-store.el

In GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.36, cairo version 1.16.0)
of 2023-01-18, modified by Debian built on x86-csail-01
Windowing system distributor 'TheX.OrgFoundation', version 11.0.12101007
System Description: Debian GNU/Linux bookworm/sid

Configured using:
'configure --build x86_64-linux-gnu --prefix=/usr
--sharedstatedir=/var/lib --libexecdir=/usr/libexec
--localstatedir=/var/lib --infodir=/usr/share/info
--mandir=/usr/share/man --with-libsystemd --with-pop=yes
--enable-locallisppath=/etc/emacs:/usr/local/share/emacs/28.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/28.2/site-lisp:/usr/share/emacs/site-lisp
--with-sound=alsa --without-gconf --with-mailutils
--with-native-compilation --build x86_64-linux-gnu --prefix=/usr
--sharedstatedir=/var/lib --libexecdir=/usr/libexec
--localstatedir=/var/lib --infodir=/usr/share/info
--mandir=/usr/share/man --with-libsystemd --with-pop=yes
--enable-locallisppath=/etc/emacs:/usr/local/share/emacs/28.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/28.2/site-lisp:/usr/share/emacs/site-lisp
--with-sound=alsa --without-gconf --with-mailutils
--with-native-compilation --with-cairo --with-x=yes
--with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
-ffile-prefix-map=/build/emacs-52aEDT/emacs-28.2+1=. -fstack-protector-strong
-Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
-D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB

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

Major mode: mu4e:compose

Minor modes in effect:
flyspell-mode: t
projectile-mode: t
which-key-mode: t
global-edit-server-edit-mode: t
mu4e-context-minor-mode: t
shell-dirtrack-mode: t
marginalia-mode: t
vertico-mode: t
global-flycheck-mode: t
flycheck-mode: t
dap-mode: t
lsp-treemacs-sync-mode: t
treemacs-filewatch-mode: t
treemacs-follow-mode: t
treemacs-git-mode: t
treemacs-fringe-indicator-mode: t
yas-global-mode: t
yas-minor-mode: t
smartparens-global-mode: t
smartparens-mode: t
override-global-mode: t
savehist-mode: t
global-display-fill-column-indicator-mode: t
display-fill-column-indicator-mode: t
global-display-line-numbers-mode: t
display-line-numbers-mode: t
global-auto-revert-mode: t
delete-selection-mode: t
cua-mode: t
mml-mode: t
tooltip-mode: t
global-eldoc-mode: t
show-paren-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
global-prettify-symbols-mode: t
file-name-shadow-mode: t
global- letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; "> letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; ">auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
column-number-mode: t
line-number-mode: t
auto-fill-function: yas--auto-fill
transient-mark-mode: t
abbrev-mode: t

Load-path shadows:
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-draft hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-draft
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-mark hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-mark
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-contrib hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-contrib
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-view hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-view
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-headers hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-headers
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-autoloads hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-autoloads
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-org hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-org
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-config hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-config
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-message hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-message
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-pkg hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-pkg
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-icalendar hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-icalendar
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-server hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-server
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-main hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-main
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-context hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-context
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-vars hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-vars
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-folders hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-folders
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-speedbar hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-speedbar
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-helpers hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-helpers
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-contacts hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-contacts
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-compose hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-compose
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-actions hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-actions
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-bookmarks hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-bookmarks
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-lists hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-lists
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-search hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-search
/usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-update hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-update
/usr/share/emacs/site-lisp/elpa/yasnippet-0.14.0/yasnippet-pkg hides /usr/share/emacs/site-lisp/elpa-src/yasnippet-0.14.0/yasnippet-pkg
/usr/share/emacs/site-lisp/elpa/yasnippet-0.14.0/yasnippet hides /usr/share/emacs/site-lisp/elpa-src/yasnippet-0.14.0/yasnippet
/usr/share/emacs/site-lisp/elpa/yasnippet-0.14.0/yasnippet-autoloads hides /usr/share/emacs/site-lisp/elpa-src/yasnippet-0.14.0/yasnippet-autoloads
/usr/share/emacs/site-lisp/elpa/yasnippet-snippets-20220713/yasnippet-snippets-autoloads hides /usr/share/emacs/site-lisp/elpa-src/yasnippet-snippets-20220713/yasnippet-snippets-autoloads
/usr/share/emacs/site-lisp/elpa/yasnippet-snippets-20220713/yasnippet-snippets-pkg hides /usr/share/emacs/site-lisp/elpa-src/yasnippet-snippets-20220713/yasnippet-snippets-pkg
/usr/share/emacs/site-lisp/elpa/yasnippet-snippets-20220713/yasnippet-snippets hides /usr/share/emacs/site-lisp/elpa-src/yasnippet-snippets-20220713/yasnippet-snippets
/home/manuel/.emacs.d/elpa/transient-20230220.1425/transient hides /usr/share/emacs/28.2/lisp/transient

Features:
(shadow emacsbug help-fns radix-tree cl-print debug backtrace ace-window
avy gnutls epa-file mailalias qp mail-extr sort flyspell ispell
face-remap orderless projectile lisp-mnt server company-box
company-box-doc frame-local company-box-icons company-oddmuse
company-keywords company-etags etags fileloop company-gtags
company-dabbrev-code company-dabbrev company-files company-clang
company-capf company-cmake company-semantic company-template
company-bbdb company cus-start which-key edit-server gnus-dired
mu4e-contrib eshell esh-cmd esh-ext esh-opt esh-proc esh-io esh-arg
esh-module esh-groups esh-util mu4e mu4e-org mu4e-main mu4e-view
mu4e-headers mu4e-compose mu4e-draft mu4e-actions smtpmail sendmail
mu4e-search mu4e-lists mu4e-bookmarks mu4e-mark mu4e-message flow-fill
mule-util mu4e-contacts mu4e-update mu4e-folders mu4e-server
mu4e-context mu4e-vars mu4e-helpers mu4e-config ido ob-ditaa ob-python
python tramp-sh tramp tramp-loaddefs trampver tramp-integration
tramp-compat shell ls-lisp org-tempo tempo find-lisp rg files-x vc
rg-info-hack rg-menu transient rg-ibuffer rg-result wgrep-rg wgrep
rg-history rg-header ibuf-ext ibuffer ibuffer-loaddefs grep cus-edit
delight marginalia vertico compat compat-29 diminish flycheck dap-dlv-go
dap-utils dap-mode dap-tasks dap-launch lsp-docker yaml posframe
dap-overlays lsp-treemacs lsp-treemacs-generic lsp-treemacs-themes
treemacs-treelib treemacs treemacs-header-line treemacs-compatibility
treemacs-mode treemacs-bookmarks treemacs-tags treemacs-interface
treemacs-persistence treemacs-filewatch-mode treemacs-follow-mode
treemacs-rendering treemacs-annotations treemacs-async
treemacs-workspaces treemacs-dom treemacs-visuals
treemacs-fringe-indicator treemacs-scope pulse treemacs-faces
treemacs-icons treemacs-themes treemacs-core-utils pfuture hl-line
treemacs-logging treemacs-customization treemacs-macros lsp-mode comp
comp-cstr warnings lsp-protocol yasnippet-snippets yasnippet xref
project tree-widget spinner network-stream nsm markdown-mode color lv
inline imenu ht f f-shortdoc shortdoc s ewoc compile use-package-delight
smartparens loadhist dash auth-source-pass use-package-bind-key bind-key
use-package-diminish savehist exec-path-from-shell
display-fill-column-indicator monokai-theme display-line-numbers
autorevert filenotify delsel cua-base cus-load elfeed-link elfeed-show
elfeed-search elfeed-csv elfeed elfeed-curl elfeed-log xml-query
bookmark pp elfeed-db elfeed-lib vc-git diff-mode vc-dispatcher
org-eldoc org-element avl-tree generator ol-eww eww xdg url-queue
thingatpt mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect
gnus-search eieio-opt cl-extra help-mode speedbar ezimage dframe
gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum shr kinsoku
svg dom gnus-group gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud
nnimap nnmail mail-source utf7 netrc nnoo parse-time gnus-spec gnus-int
gnus-range message rmc puny rfc822 mml mml-sec epa derived epg rfc6068
epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader gnus-win gnus nnheader gnus-util rmail
rmail-loaddefs rfc2047 rfc2045 ietf-drums text-property-search
mail-utils mm-util mail-prsvr wid-edit ol-docview doc-view jka-compr
image-mode exif dired dired-loaddefs ol-bibtex ol-bbdb ol-w3m ol-doi
org-link-doi org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-footnote org-src ob-comint org-pcomplete pcomplete comint ansi-color
ring org-list org-faces org-entities noutline outline easy-mmode
org-version ob-emacs-lisp ob-core ob-eval org-table oc-basic bibtex
iso8601 time-date ol org-keys oc org-compat advice org-macs org-loaddefs
format-spec find-func suomalainen-kalenteri cal-menu calendar
cal-loaddefs use-package-ensure use-package-core finder-inf rx pcase
info edmacro kmacro package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq
byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib iso-transl
tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode 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 lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; ">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 emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system- letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; ">cairo move-toolbar gtk x-toolkit x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses16 761128 180281)
(symbols48 54096 413)
(strings32 227206 46307)
(string-bytes 17721961)
(vectors16 98095)
(vector-slots 82445440 359628)
(floats 8681 1559)
(intervals56 1533 863)
(buffers 992 22))