Help with sending mail from notmuch-emacs

Subject: Help with sending mail from notmuch-emacs

Date: Mon, 09 May 2022 17:54:12 -0400

To: notmuch@notmuchmail.org

Cc:

From: hgv


Dear Notmuch list,

I have used notmuch (very happily) for a number of years with alot as my client. I'm now trying out the emacs client (with doom emacs), which is very cool so far. But I am struggling with two particular points around sending emails and cannot solve them on my own. I am also new to emacs, so please forgive my struggles that stem from being a newbie there.

1. Mail gets sent but doesn't save in the correct directory via FCC. I use msmtpq as my sending program. Upon sending, I receive this message: "message-send-mail-with-sendmail: Sending...failed to   mail for [ -oi -f hgv@fastmail.com -t ] : send was successful;" The mail is sent but is not saved in the fcc dir nor entered into the notmuch database. I have enabled emacs debugger (on entry with different functions related to sending) and stepped through the process but didn't see any pertinent information in the messages. My fcc line reads `(setq notmuch-fcc-dirs "fastmail/Sent +sent +inbox +sent-new")` (fuller notmuch-emacs config below). Any guidance on fixing or further troubleshooting (what should I look for on debugger) is appreciated.

2. I have my emacs setup to prefer utf-8 encoding in basically all situations. Emails I send with emacs seem to be correctly encoded. But the Content-Type header is set only to "text/plain" rather than "text/plain; charset=utf-8" (as it is in alot and as it should be). Further, there is no Content-Transfer-Encoding header set. Based on my reading of the emacs message mode docs, Content-Transfer-Encoding should be set on the fly depending on the Content-Type and other factors (to either "quoted-printable" or "base64" for "text/plain"). Perhaps I should not worry about these headers; but it seems like they affect whether mail gets delivered at certain providers and certainly how it displays. Any advice on getting both Content-Type and Content-Transfer-Encoding to set correctly? (Without my settings that prefer utf-8, my emails are ascii encoded and the Content-Type is set as "text/plain; charset=us-ascii" but still no Content-Transfer-Encoding.)

I'm on macos 10.15.7, with notmuch .35 (via homebrew), and GNU emacs 28.1 (from https://github.com/d12frosted/homebrew-emacs-plus via homebrew).

Thank you for your help and for the tremendous software!
hgv

```
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-

---snip---

;; mainly force utf-8
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(set-file-name-coding-system 'utf-8)
(set-clipboard-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8)

---snip---

;; gnus-alias
(autoload 'gnus-alias-determine-identity "gnus-alias" "" t)
(add-hook 'message-setup-hook 'gnus-alias-determine-identity)
(setq gnus-alias-identity-alist
  '(("fastmail"
   ---snip---
   ))
;; Use "fastmail" identity by default
(setq gnus-alias-default-identity "fastmail")
;; Define rules to match work identity
(setq gnus-alias-identity-rules
  ---snip---
  ))
;; sorting out regex and replying
(setq gnus-alias-override-user-mail-address t)
(setq gnus-alias-unknown-identity-rule 'default)

;; auto save
(setq message-auto-save-directory "~/.config/emacs/.local/cache/notmuch/unsaved-drafts")
;; supposedly outdated
;; now sourced from language
(setq message-default-charset "utf-8")
(setq mm-coding-system-priorities '(utf-8))

;; notmuch
(after! notmuch
  (setq +notmuch-sync-backend "notmuch new"
    +notmuch-delete-tags '("+ztrash")
    +notmuch-spam-tags '("+spam")
    notmuch-draft-tags '("+draft" "-new")
    notmuch-archive-tags '("-inbox" "-unread"))
  (setq notmuch-mua-compose-in 'new-window)
  (setq notmuch-mua-user-agent-function 'notmuch-mua-user-agent-notmuch)
  (setq message-kill-buffer-on-exit t)
  (setq message-send-mail-function 'message-send-mail-with-sendmail)
  (setq sendmail-program "msmtpq"
    mail-specify-envelope-from t
    message-sendmail-f-is-evil nil
    mail-envelope-from 'header
    message-sendmail-envelope-from 'header)
  (setq notmuch-address-save-filename "~/.config/emacs/.local/notmuch/address-cache")
  (setq notmuch-draft-folder "fastmail/Drafts")
  ;; overwritten from ~/.config/emacs/.local/straight/repos/notmuch/emacs/notmuch-draft.el
  (defun notmuch-draft--mark-deleted ()
    (when notmuch-draft-id
      (notmuch-tag notmuch-draft-id '("+ztrash"))))
  (setq notmuch-fcc-dirs "fastmail/Sent +sent +inbox +sent-new")
  (setq notmuch-identities
  ---snip---
  (setq notmuch-mua-send-hook '(notmuch-mua-attachment-check))
  (setq notmuch-show-empty-saved-searches nil)
  (setq notmuch-multipart/alternative-discouraged '("text/plain" "text/html"))
  (setq notmuch-saved-searches
     ---snip--- 
      )))
```
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: