From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#63311: 30.0.50; [PATCH] smtpmail-send-it split Date: Fri, 05 May 2023 15:13:32 +0200 Message-ID: <87jzxmsyyr.fsf@ledu-giraud.fr> Reply-To: Manuel Giraud Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15387"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: 63311@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 05 17:10:18 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pux4c-0003qT-BK for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 May 2023 17:10:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pux4N-0008K2-Rs; Fri, 05 May 2023 11:10:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pux4M-0008JE-60 for bug-gnu-emacs@gnu.org; Fri, 05 May 2023 11:10:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pux4L-0007uS-TQ for bug-gnu-emacs@gnu.org; Fri, 05 May 2023 11:10:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pux4L-0003Mo-Mc for bug-gnu-emacs@gnu.org; Fri, 05 May 2023 11:10:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Manuel Giraud Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 May 2023 15:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 63311 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.168329937112891 (code B ref -1); Fri, 05 May 2023 15:10:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 5 May 2023 15:09:31 +0000 Original-Received: from localhost ([127.0.0.1]:57253 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pux3p-0003Lk-W1 for submit@debbugs.gnu.org; Fri, 05 May 2023 11:09:31 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:45464) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pux3l-0003LY-Dv for submit@debbugs.gnu.org; Fri, 05 May 2023 11:09:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pux3l-0007wB-8R for bug-gnu-emacs@gnu.org; Fri, 05 May 2023 11:09:25 -0400 Original-Received: from ledu-giraud.fr ([51.159.28.247]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pux3h-0007pg-H7 for bug-gnu-emacs@gnu.org; Fri, 05 May 2023 11:09:25 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=AfeXw1q/ JOIEcjJ9DuxJHQJ1tlkfe93aGWYxcvEioeg=; h=date:subject:to:from; d=ledu-giraud.fr; b=M/9PkJbF2dkkukgFBUrIP1SuAMOJSQV62v5hawxilWkn9xYpqY bZuSNvMrqJsqZ2wcXnlSpxGzGv8BIGsjD9Cw== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=AfeXw1q/JOIEcjJ9 DuxJHQJ1tlkfe93aGWYxcvEioeg=; h=date:subject:to:from; d=ledu-giraud.fr; b=ntRD5YdVDoSjwa/8BtCmr3KQBhoK30HkciCzsjfuXcn2Ls2PQD vuCgUbdh4EvFcfUi6izJP6hbhisAT+kZhp7rCDXQngrEigK9c1UH9BWjfjE1ZO06doQBcV MLCCLWJ9WPH2bVyo4tEp4JPfNKgSsrGp/OHak4mvoWe5ZQ8cHDGzNFf90B1zy7/50yN0lo OvlvKPR3Uy5VM+lPtXTrHLw6hd9B3dx9Zp/TQf/jBW59GjrsgavJr5mmHTdjOxpB74iY0i o1ewd6X3AGjv0xTfjF/okuUB/lfF8kv08Gmv5r0fr3M+Rhtjcld0P7cUtkY/wepRIUgE/Y 9TBz0XR5fZHw== Original-Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id ba6276bf (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 5 May 2023 17:09:17 +0200 (CEST) Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@ledu-giraud.fr; helo=ledu-giraud.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261114 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, I'm trying to make sending mail over SMTP asynchronous. For this, I'm working on 'smtpmail-send-it'=E2=80=A6 but I think that that function does = too much and is hard to reason about. This patch just splits 'smtpmail-send-it' work into three functions: prepare a mail and queue it or send it. There should be no change in functionality (it is mostly code refactoring). I've tested it a bit with sending and queueing and this seems to work correctly but this needs way more eyes and tests. BTW, does anyone know the purpose of 'errbuf': I see it is created then erased and then killed? --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-smtpmail-send-it-split.patch >From 6481038443deae8bf4e309a641f5ce77717be712 Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Fri, 5 May 2023 14:35:01 +0200 Subject: [PATCH] smtpmail-send-it split * lisp/mail/smtpmail.el (smtpmail-prepare-mail): New function that prepares the mail with current buffer content. (smtpmail-queue-mail): New function to queue a mail (prepared by 'smtpmail-prepare-mail'). (smtpmail-send-mail): New function to send a mail (prepared by 'smtpmail-send-mail'). (smtpmail-send-it): Use all three previous functions. --- lisp/mail/smtpmail.el | 407 +++++++++++++++++++++--------------------- 1 file changed, 206 insertions(+), 201 deletions(-) diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index 78688d170cc..7c61ca29de6 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el @@ -205,214 +205,219 @@ smtpmail-mail-address "Value to use for envelope-from address for mail from ambient buffer.") ;;; Functions +(defun smtpmail-prepare-mail (tembuf errbuf smtpmail-code-conv-from) + (let ((case-fold-search nil) + delimline + (mailbuf (current-buffer)) + ;; Examine this variable now, so that + ;; local binding in the mail buffer will take effect. + (smtpmail-mail-address + (save-restriction + ;; Only look at the headers when fetching the + ;; envelope address. + (message-narrow-to-headers) + (or (and mail-specify-envelope-from (mail-envelope-from)) + (let ((from (mail-fetch-field "from"))) + (and from + (cadr (mail-extract-address-components from)))) + (smtpmail-user-mail-address))))) + (with-current-buffer tembuf + (erase-buffer) + ;; Use the same `buffer-file-coding-system' as in the mail + ;; buffer, otherwise any `write-region' invocations (e.g., in + ;; mail-do-fcc below) will annoy with asking for a suitable + ;; encoding. + (set-buffer-file-coding-system smtpmail-code-conv-from nil t) + (insert-buffer-substring mailbuf) + (goto-char (point-max)) + ;; require one newline at the end. + (or (= (preceding-char) ?\n) + (insert ?\n)) + ;; Change header-delimiter to be what sendmail expects. + (mail-sendmail-undelimit-header) + (setq delimline (point-marker)) + (if mail-aliases + (expand-mail-aliases (point-min) delimline)) + (goto-char (point-min)) + ;; ignore any blank lines in the header + (while (and (re-search-forward "\n\n\n*" delimline t) + (< (point) delimline)) + (replace-match "\n")) + (let ((case-fold-search t)) + ;; We used to process Resent-... headers here, + ;; but it was not done properly, and the job + ;; is done correctly in `smtpmail-deduce-address-list'. + ;; Don't send out a blank subject line + (goto-char (point-min)) + (if (re-search-forward "^Subject:\\([ \t]*\n\\)+\\b" delimline t) + (replace-match "") + ;; This one matches a Subject just before the header delimiter. + (if (and (re-search-forward "^Subject:\\([ \t]*\n\\)+" delimline t) + (= (match-end 0) delimline)) + (replace-match ""))) + ;; Put the "From:" field in unless for some odd reason + ;; they put one in themselves. + (goto-char (point-min)) + (if (not (re-search-forward "^From:" delimline t)) + (let* ((login smtpmail-mail-address) + (fullname (user-full-name))) + (cond ((eq mail-from-style 'angles) + (insert "From: " fullname) + (let ((fullname-start (+ (point-min) 6)) + (fullname-end (point-marker))) + (goto-char fullname-start) + ;; Look for a character that cannot appear unquoted + ;; according to RFC 822 or its successors. + (if (re-search-forward "[^- !#-'*+/-9=?A-Z^-~]" + fullname-end 1) + (progn + ;; Quote fullname, escaping specials. + (goto-char fullname-start) + (insert "\"") + (while (re-search-forward "[\"\\]" + fullname-end 1) + (replace-match "\\\\\\&" t)) + (insert "\"")))) + (insert " <" login ">\n")) + ((eq mail-from-style 'parens) + (insert "From: " login " (") + (let ((fullname-start (point))) + (insert fullname) + (let ((fullname-end (point-marker))) + (goto-char fullname-start) + ;; RFC 822 and its successors say \ and + ;; nonmatching parentheses must be + ;; escaped in comments. + ;; Escape every instance of ()\ ... + (while (re-search-forward "[()\\]" fullname-end 1) + (replace-match "\\\\\\&" t)) + ;; ... then undo escaping of matching parentheses, + ;; including matching nested parentheses. + (goto-char fullname-start) + (while (re-search-forward + "\\(\\=\\|[^\\]\\(\\\\\\\\\\)*\\)\\\\(\\(\\([^\\]\\|\\\\\\\\\\)*\\)\\\\)" + fullname-end 1) + (replace-match "\\1(\\3)" t) + (goto-char fullname-start)))) + (insert ")\n")) + ((null mail-from-style) + (insert "From: " login "\n"))))) + ;; Insert a `Message-Id:' field if there isn't one yet. + (goto-char (point-min)) + (unless (re-search-forward "^Message-Id:" delimline t) + (insert "Message-Id: " (message-make-message-id) "\n")) + ;; Insert a `Date:' field if there isn't one yet. + (goto-char (point-min)) + (unless (re-search-forward "^Date:" delimline t) + (insert "Date: " (message-make-date) "\n")) + ;; Possibly add a MIME header for the current coding system + (let (charset) + (goto-char (point-min)) + (and (eq mail-send-nonascii 'mime) + (not (re-search-forward "^MIME-version:" delimline t)) + (progn (skip-chars-forward "\0-\177") + (/= (point) (point-max))) + smtpmail-code-conv-from + (setq charset + (coding-system-get smtpmail-code-conv-from + 'mime-charset)) + (goto-char delimline) + (insert "MIME-version: 1.0\n" + "Content-type: text/plain; charset=" + (symbol-name charset) + "\nContent-Transfer-Encoding: 8bit\n"))) + ;; Insert an extra newline if we need it to work around + ;; Sun's bug that swallows newlines. + (goto-char (1+ delimline)) + ;; Find and handle any Fcc fields. + (goto-char (point-min)) + (if (re-search-forward "^Fcc:" delimline t) + ;; Force `mail-do-fcc' to use the encoding of the mail + ;; buffer to encode outgoing messages on Fcc files. + (let ((coding-system-for-write + ;; mbox files must have Unix EOLs. + (coding-system-change-eol-conversion + smtpmail-code-conv-from 'unix))) + (mail-do-fcc delimline))) + (if mail-interactive + (with-current-buffer errbuf + (erase-buffer)))) + ;; Encode the header according to RFC2047. + (mail-encode-header (point-min) delimline) + ;; + (setq smtpmail-address-buffer (generate-new-buffer "*smtp-mail*")) + (setq smtpmail-recipient-address-list + (smtpmail-deduce-address-list tembuf (point-min) delimline)) + (kill-buffer smtpmail-address-buffer) + + (smtpmail-do-bcc delimline)))) + +(defun smtpmail-queue-mail (tembuf smtpmail-code-conv-from) + (let* ((file-data + (expand-file-name + (format "%s_%i" + (format-time-string "%Y-%m-%d_%H:%M:%S") + (setq smtpmail-queue-counter + (1+ smtpmail-queue-counter))) + smtpmail-queue-dir)) + (file-data (convert-standard-filename file-data)) + (file-elisp (concat file-data ".el")) + (buffer-data (create-file-buffer file-data))) + (unless (file-exists-p smtpmail-queue-dir) + (make-directory smtpmail-queue-dir t)) + (with-current-buffer buffer-data + (erase-buffer) + (set-buffer-file-coding-system + ;; We will be reading the file with no-conversion in + ;; smtpmail-send-queued-mail below, so write it out + ;; with Unix EOLs. + (coding-system-change-eol-conversion + (or smtpmail-code-conv-from 'undecided) + 'unix) + nil t) + (insert-buffer-substring tembuf) + (write-file file-data) + (let ((coding-system-for-write 'utf-8)) + (with-temp-buffer + (insert "(setq ") + (dolist (var (cons 'smtpmail-recipient-address-list + ;; Perhaps store the server etc. + (and smtpmail-store-queue-variables + smtpmail--stored-queue-variables))) + (insert (format " %s %S\n" var (symbol-value var)))) + (insert ")\n") + (write-region (point-min) (point-max) file-elisp + nil 'silent))) + (write-region (concat file-data "\n") nil + (expand-file-name smtpmail-queue-index-file + smtpmail-queue-dir) + t 'silent)) + (kill-buffer buffer-data))) + +(defun smtpmail-send-mail (tembuf) + (if (not (null smtpmail-recipient-address-list)) + (when (setq result + (smtpmail-via-smtp + smtpmail-recipient-address-list tembuf)) + (error "Sending failed: %s" + (smtpmail--sanitize-error-message result))) + (error "Sending failed; no recipients"))) ;;;###autoload (defun smtpmail-send-it () (let ((errbuf (if mail-interactive (generate-new-buffer " smtpmail errors") 0)) - (tembuf (generate-new-buffer " smtpmail temp")) - (case-fold-search nil) - delimline - result - (mailbuf (current-buffer)) - ;; Examine this variable now, so that - ;; local binding in the mail buffer will take effect. - (smtpmail-mail-address - (save-restriction - ;; Only look at the headers when fetching the - ;; envelope address. - (message-narrow-to-headers) - (or (and mail-specify-envelope-from (mail-envelope-from)) - (let ((from (mail-fetch-field "from"))) - (and from - (cadr (mail-extract-address-components from)))) - (smtpmail-user-mail-address)))) - (smtpmail-code-conv-from - (if enable-multibyte-characters - (let ((sendmail-coding-system smtpmail-code-conv-from)) - (select-message-coding-system))))) + (tembuf (generate-new-buffer " smtpmail temp"))) (unwind-protect - (with-current-buffer tembuf - (erase-buffer) - ;; Use the same `buffer-file-coding-system' as in the mail - ;; buffer, otherwise any `write-region' invocations (e.g., in - ;; mail-do-fcc below) will annoy with asking for a suitable - ;; encoding. - (set-buffer-file-coding-system smtpmail-code-conv-from nil t) - (insert-buffer-substring mailbuf) - (goto-char (point-max)) - ;; require one newline at the end. - (or (= (preceding-char) ?\n) - (insert ?\n)) - ;; Change header-delimiter to be what sendmail expects. - (mail-sendmail-undelimit-header) - (setq delimline (point-marker)) - ;; (sendmail-synch-aliases) - (if mail-aliases - (expand-mail-aliases (point-min) delimline)) - (goto-char (point-min)) - ;; ignore any blank lines in the header - (while (and (re-search-forward "\n\n\n*" delimline t) - (< (point) delimline)) - (replace-match "\n")) - (let ((case-fold-search t)) - ;; We used to process Resent-... headers here, - ;; but it was not done properly, and the job - ;; is done correctly in `smtpmail-deduce-address-list'. - ;; Don't send out a blank subject line - (goto-char (point-min)) - (if (re-search-forward "^Subject:\\([ \t]*\n\\)+\\b" delimline t) - (replace-match "") - ;; This one matches a Subject just before the header delimiter. - (if (and (re-search-forward "^Subject:\\([ \t]*\n\\)+" delimline t) - (= (match-end 0) delimline)) - (replace-match ""))) - ;; Put the "From:" field in unless for some odd reason - ;; they put one in themselves. - (goto-char (point-min)) - (if (not (re-search-forward "^From:" delimline t)) - (let* ((login smtpmail-mail-address) - (fullname (user-full-name))) - (cond ((eq mail-from-style 'angles) - (insert "From: " fullname) - (let ((fullname-start (+ (point-min) 6)) - (fullname-end (point-marker))) - (goto-char fullname-start) - ;; Look for a character that cannot appear unquoted - ;; according to RFC 822 or its successors. - (if (re-search-forward "[^- !#-'*+/-9=?A-Z^-~]" - fullname-end 1) - (progn - ;; Quote fullname, escaping specials. - (goto-char fullname-start) - (insert "\"") - (while (re-search-forward "[\"\\]" - fullname-end 1) - (replace-match "\\\\\\&" t)) - (insert "\"")))) - (insert " <" login ">\n")) - ((eq mail-from-style 'parens) - (insert "From: " login " (") - (let ((fullname-start (point))) - (insert fullname) - (let ((fullname-end (point-marker))) - (goto-char fullname-start) - ;; RFC 822 and its successors say \ and - ;; nonmatching parentheses must be - ;; escaped in comments. - ;; Escape every instance of ()\ ... - (while (re-search-forward "[()\\]" fullname-end 1) - (replace-match "\\\\\\&" t)) - ;; ... then undo escaping of matching parentheses, - ;; including matching nested parentheses. - (goto-char fullname-start) - (while (re-search-forward - "\\(\\=\\|[^\\]\\(\\\\\\\\\\)*\\)\\\\(\\(\\([^\\]\\|\\\\\\\\\\)*\\)\\\\)" - fullname-end 1) - (replace-match "\\1(\\3)" t) - (goto-char fullname-start)))) - (insert ")\n")) - ((null mail-from-style) - (insert "From: " login "\n"))))) - ;; Insert a `Message-Id:' field if there isn't one yet. - (goto-char (point-min)) - (unless (re-search-forward "^Message-Id:" delimline t) - (insert "Message-Id: " (message-make-message-id) "\n")) - ;; Insert a `Date:' field if there isn't one yet. - (goto-char (point-min)) - (unless (re-search-forward "^Date:" delimline t) - (insert "Date: " (message-make-date) "\n")) - ;; Possibly add a MIME header for the current coding system - (let (charset) - (goto-char (point-min)) - (and (eq mail-send-nonascii 'mime) - (not (re-search-forward "^MIME-version:" delimline t)) - (progn (skip-chars-forward "\0-\177") - (/= (point) (point-max))) - smtpmail-code-conv-from - (setq charset - (coding-system-get smtpmail-code-conv-from - 'mime-charset)) - (goto-char delimline) - (insert "MIME-version: 1.0\n" - "Content-type: text/plain; charset=" - (symbol-name charset) - "\nContent-Transfer-Encoding: 8bit\n"))) - ;; Insert an extra newline if we need it to work around - ;; Sun's bug that swallows newlines. - (goto-char (1+ delimline)) - ;; Find and handle any Fcc fields. - (goto-char (point-min)) - (if (re-search-forward "^Fcc:" delimline t) - ;; Force `mail-do-fcc' to use the encoding of the mail - ;; buffer to encode outgoing messages on Fcc files. - (let ((coding-system-for-write - ;; mbox files must have Unix EOLs. - (coding-system-change-eol-conversion - smtpmail-code-conv-from 'unix))) - (mail-do-fcc delimline))) - (if mail-interactive - (with-current-buffer errbuf - (erase-buffer)))) - ;; Encode the header according to RFC2047. - (mail-encode-header (point-min) delimline) - ;; - (setq smtpmail-address-buffer (generate-new-buffer "*smtp-mail*")) - (setq smtpmail-recipient-address-list - (smtpmail-deduce-address-list tembuf (point-min) delimline)) - (kill-buffer smtpmail-address-buffer) - - (smtpmail-do-bcc delimline) - ;; Send or queue - (if (not smtpmail-queue-mail) - (if (not (null smtpmail-recipient-address-list)) - (when (setq result - (smtpmail-via-smtp - smtpmail-recipient-address-list tembuf)) - (error "Sending failed: %s" - (smtpmail--sanitize-error-message result))) - (error "Sending failed; no recipients")) - (let* ((file-data - (expand-file-name - (format "%s_%i" - (format-time-string "%Y-%m-%d_%H:%M:%S") - (setq smtpmail-queue-counter - (1+ smtpmail-queue-counter))) - smtpmail-queue-dir)) - (file-data (convert-standard-filename file-data)) - (file-elisp (concat file-data ".el")) - (buffer-data (create-file-buffer file-data))) - (unless (file-exists-p smtpmail-queue-dir) - (make-directory smtpmail-queue-dir t)) - (with-current-buffer buffer-data - (erase-buffer) - (set-buffer-file-coding-system - ;; We will be reading the file with no-conversion in - ;; smtpmail-send-queued-mail below, so write it out - ;; with Unix EOLs. - (coding-system-change-eol-conversion - (or smtpmail-code-conv-from 'undecided) - 'unix) - nil t) - (insert-buffer-substring tembuf) - (write-file file-data) - (let ((coding-system-for-write 'utf-8)) - (with-temp-buffer - (insert "(setq ") - (dolist (var (cons 'smtpmail-recipient-address-list - ;; Perhaps store the server etc. - (and smtpmail-store-queue-variables - smtpmail--stored-queue-variables))) - (insert (format " %s %S\n" var (symbol-value var)))) - (insert ")\n") - (write-region (point-min) (point-max) file-elisp - nil 'silent))) - (write-region (concat file-data "\n") nil - (expand-file-name smtpmail-queue-index-file - smtpmail-queue-dir) - t 'silent)) - (kill-buffer buffer-data)))) + (let ((smtpmail-code-conv-from + (if enable-multibyte-characters + (let ((sendmail-coding-system smtpmail-code-conv-from)) + (select-message-coding-system))))) + (smtpmail-prepare-mail tembuf errbuf smtpmail-code-conv-from) + (if smtpmail-queue-mail + (smtpmail-queue-mail tembuf smtpmail-code-conv-from) + (smtpmail-send-mail tembuf))) (kill-buffer tembuf) (if (bufferp errbuf) (kill-buffer errbuf))))) -- 2.40.0 --=-=-= Content-Type: text/plain In GNU Emacs 30.0.50 (build 1, x86_64-unknown-openbsd7.3, cairo version 1.17.8) of 2023-05-05 built on computer Repository revision: f204c4a6cfa77fdbb2573b728110576e206b0b20 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101006 System Description: OpenBSD computer 7.3 GENERIC.MP#1125 amd64 Configured using: 'configure --prefix=/home/manuel/emacs --bindir=/home/manuel/bin --with-x-toolkit=no --without-sound --without-compress-install CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib' Configured features: CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBXML2 MODULES NOTIFY KQUEUE OLDXMENU PDUMPER PNG RSVG SQLITE3 THREADS TIFF TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM ZLIB Important settings: value of $LC_ALL: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Magit Minor modes in effect: global-git-commit-mode: t magit-auto-revert-mode: t display-time-mode: t display-battery-mode: t server-mode: t shell-dirtrack-mode: t override-global-mode: t repeat-mode: t desktop-save-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t buffer-read-only: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: /home/manuel/.emacs.d/elpa/ef-themes-0.11.0/theme-loaddefs hides /home/manuel/emacs/share/emacs/30.0.50/lisp/theme-loaddefs /home/manuel/.emacs.d/elpa/transient-0.3.7/transient hides /home/manuel/emacs/share/emacs/30.0.50/lisp/transient Features: (shadow goto-addr dabbrev emacsbug whitespace magit-patch misearch multi-isearch magit-extras face-remap magit-submodule magit-obsolete magit-blame magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit magit-sequence magit-notes magit-worktree magit-tag magit-merge magit-branch magit-reset magit-files magit-refs magit-status magit magit-repos magit-apply magit-wip magit-log which-func imenu magit-diff smerge-mode diff git-commit log-edit add-log magit-core magit-autorevert magit-margin magit-transient magit-process with-editor magit-mode transient magit-git magit-section magit-utils dash shr-color gnus-cite gnus-async gnus-bcklg gnus-ml gnus-topic mm-archive url-cache qp utf-7 imap rfc2104 nndoc nndraft nnmh nnfolder nnml gnus-agent gnus-srvr gnus-score score-mode nnvirtual nntp gnus-cache nnrss mm-url network-stream mailalias textsec uni-scripts idna-mapping ucs-normalize uni-confusable textsec-check sort mail-extr pulse tabify cus-edit cus-start cl-print smtpmail help-fns radix-tree vc-bzr vc-src vc-sccs vc-cvs vc-rcs log-view pcvs-util sh-script smie treesit executable vc-hg conf-mode view pascal vc mule-util hi-lock autorevert filenotify vc-git diff-mode vc-dispatcher vc-svn bug-reference paredit gnus-dired time battery cus-load exwm-randr xcb-randr exwm-config ido exwm exwm-input xcb-keysyms xcb-xkb exwm-manage exwm-floating xcb-cursor xcb-render exwm-layout exwm-workspace exwm-core xcb-ewmh xcb-icccm xcb xcb-xproto xcb-types xcb-debug server modus-operandi-theme modus-themes zone speed-type url-http url-auth url-gw nsm compat ytdious mingus libmpdee reporter edebug debug backtrace transmission color calc-bin calc-ext calc calc-loaddefs rect calc-macs supercite regi ebdb-message ebdb-gnus gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig gnus-sum shr pixel-fill kinsoku url-file svg dom gnus-group gnus-undo gnus-start gnus-dbus gnus-cloud nnimap nnmail mail-source utf7 nnoo gnus-spec gnus-int gnus-range message sendmail yank-media puny rfc822 mml mml-sec epa epg rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums gmm-utils mailheader gnus-win gnus nnheader gnus-util mail-utils range mm-util mail-prsvr wid-edit ebdb-mua ebdb-com crm ebdb-format ebdb mailabbrev eieio-opt speedbar ezimage dframe find-func eieio-base pcase timezone visual-basic-mode cl web-mode derived disp-table erlang-start smart-tabs-mode skeleton cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs slime-asdf grep slime-tramp tramp rx tramp-loaddefs trampver tramp-integration files-x tramp-compat xdg shell pcomplete parse-time iso8601 time-date ls-lisp format-spec slime-fancy slime-indentation slime-cl-indent cl-indent slime-trace-dialog slime-fontifying-fu slime-package-fu slime-references slime-compiler-notes-tree advice slime-scratch slime-presentations bridge slime-macrostep macrostep slime-mdot-fu slime-enclosing-context slime-fuzzy slime-fancy-trace slime-fancy-inspector slime-c-p-c slime-editing-commands slime-autodoc slime-repl slime-parse slime apropos compile text-property-search etags fileloop generator xref project arc-mode archive-mode noutline outline icons pp comint ansi-osc ansi-color ring hyperspec thingatpt slime-autoloads edmacro kmacro use-package-bind-key bind-key appt diary-lib diary-loaddefs cal-menu calendar cal-loaddefs dired-x dired-aux dired dired-loaddefs notifications dbus xml cl-extra help-mode use-package-core repeat easy-mmode desktop frameset rust-mode-autoloads speed-type-autoloads osm-autoloads ebdb-autoloads compat-autoloads magit-autoloads debbugs-autoloads git-commit-autoloads magit-section-autoloads ef-themes-autoloads with-editor-autoloads paredit-autoloads dash-autoloads ytdious-autoloads transmission-autoloads transient-autoloads exwm-autoloads hyperbole-autoloads detached-autoloads info package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl tooltip cconv 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 font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine 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 abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind kqueue lcms2 dynamic-setting system-font-setting font-render-setting cairo xinput2 x multi-tty make-network-process emacs) Memory information: ((conses 16 933133 308956) (symbols 48 55180 35) (strings 32 272198 12320) (string-bytes 1 8555283) (vectors 16 173055) (vector-slots 8 2925695 155806) (floats 8 544 5262) (intervals 56 18111 2469) (buffers 984 113)) -- Manuel Giraud --=-=-=--