all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Reviving qmail with X-Message-SMTP-Method in Gnus
@ 2023-04-27  2:05 Mohsen BANAN
  2023-04-27  6:00 ` Eli Zaretskii
  2023-05-04  6:46 ` Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: Mohsen BANAN @ 2023-04-27  2:05 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]


Dear Colleagues,

I have been using qmail (as a resident MTA) with
Gnus through X-Message-SMTP-Method based on the
attached patch.

It is just two lines.

All of what is needed to support qmail is already
in Gnus and these two lines revives them.

Lars, could you please apply this patch?

Documentation can also then be updated in:
https://www.gnu.org/software/emacs/manual/html_node/message/Mail-Variables.html

Architecture of qmail makes for an excellent
customizable mail sending agent which can be
integrated with Gnus. More on this later ...

Thanks and regards,

---
Mohsen BANAN  --- http://mohsen.1.banan.byname.net



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Reviving-qmail-with-X-Message-SMTP-Method-in-Gnus.patch --]
[-- Type: text/x-diff, Size: 773 bytes --]

From 13e47efe3c15e7afe3f6db98681e31125d199f58 Mon Sep 17 00:00:00 2001
From: Mohsen Banan <form@mohsen.banan.1.byname.net>
Date: Wed, 26 Apr 2023 18:35:13 -0700
Subject: [PATCH] Reviving qmail with X-Message-SMTP-Method in Gnus

---
 lisp/gnus/message.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 7a71ac9f58e..865e5c99000 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -5017,6 +5017,8 @@ message-multi-smtp-send-mail
       (cond
        ((equal (car method) "sendmail")
 	(message-send-mail-with-sendmail))
+      ((equal (car method) "qmail")
+	(message-send-mail-with-qmail))
        ((equal (car method) "smtp")
 	(require 'smtpmail)
 	(let* ((smtpmail-store-queue-variables t)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] Reviving qmail with X-Message-SMTP-Method in Gnus
  2023-04-27  2:05 [PATCH] Reviving qmail with X-Message-SMTP-Method in Gnus Mohsen BANAN
@ 2023-04-27  6:00 ` Eli Zaretskii
  2023-05-04  6:46 ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2023-04-27  6:00 UTC (permalink / raw)
  To: Mohsen BANAN; +Cc: emacs-devel

> From: Mohsen BANAN <emacs@mohsen.1.banan.byname.net>
> Date: Wed, 26 Apr 2023 19:05:04 -0700
> 
> I have been using qmail (as a resident MTA) with
> Gnus through X-Message-SMTP-Method based on the
> attached patch.
> 
> It is just two lines.
> 
> All of what is needed to support qmail is already
> in Gnus and these two lines revives them.
> 
> Lars, could you please apply this patch?
> 
> Documentation can also then be updated in:
> https://www.gnu.org/software/emacs/manual/html_node/message/Mail-Variables.html

Thanks.

Please in the future send such suggestions and problem reports using
"M-x report-emacs-bug RET", so that it gets sent to the Emacs bug
tracker, and the entire discussion is then recorded there.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Reviving qmail with X-Message-SMTP-Method in Gnus
  2023-04-27  2:05 [PATCH] Reviving qmail with X-Message-SMTP-Method in Gnus Mohsen BANAN
  2023-04-27  6:00 ` Eli Zaretskii
@ 2023-05-04  6:46 ` Eli Zaretskii
  2023-05-04  7:32   ` Andrew Cohen
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-05-04  6:46 UTC (permalink / raw)
  To: Mohsen BANAN, Andrew Cohen; +Cc: emacs-devel, Lars Ingebrigtsen

> From: Mohsen BANAN <emacs@mohsen.1.banan.byname.net>
> Date: Wed, 26 Apr 2023 19:05:04 -0700
> 
> Dear Colleagues,
> 
> I have been using qmail (as a resident MTA) with
> Gnus through X-Message-SMTP-Method based on the
> attached patch.
> 
> It is just two lines.
> 
> All of what is needed to support qmail is already
> in Gnus and these two lines revives them.
> 
> Lars, could you please apply this patch?
> 
> Documentation can also then be updated in:
> https://www.gnu.org/software/emacs/manual/html_node/message/Mail-Variables.html
> 
> Architecture of qmail makes for an excellent
> customizable mail sending agent which can be
> integrated with Gnus. More on this later ...
> 
> Thanks and regards,
> 
> ---
> Mohsen BANAN  --- http://mohsen.1.banan.byname.net
> 
> >From 13e47efe3c15e7afe3f6db98681e31125d199f58 Mon Sep 17 00:00:00 2001
> From: Mohsen Banan <form@mohsen.banan.1.byname.net>
> Date: Wed, 26 Apr 2023 18:35:13 -0700
> Subject: [PATCH] Reviving qmail with X-Message-SMTP-Method in Gnus
> 
> ---
>  lisp/gnus/message.el | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
> index 7a71ac9f58e..865e5c99000 100644
> --- a/lisp/gnus/message.el
> +++ b/lisp/gnus/message.el
> @@ -5017,6 +5017,8 @@ message-multi-smtp-send-mail
>        (cond
>         ((equal (car method) "sendmail")
>  	(message-send-mail-with-sendmail))
> +      ((equal (car method) "qmail")
> +	(message-send-mail-with-qmail))
>         ((equal (car method) "smtp")
>  	(require 'smtpmail)
>  	(let* ((smtpmail-store-queue-variables t)
> -- 
> 2.30.2

Andrew, Lars: any objections to adding this to message.el?



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Reviving qmail with X-Message-SMTP-Method in Gnus
  2023-05-04  6:46 ` Eli Zaretskii
@ 2023-05-04  7:32   ` Andrew Cohen
  2023-05-04  8:03     ` Eli Zaretskii
  2023-05-04 16:02     ` Mohsen BANAN
  0 siblings, 2 replies; 7+ messages in thread
From: Andrew Cohen @ 2023-05-04  7:32 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Mohsen BANAN, Andrew Cohen, emacs-devel, Lars Ingebrigtsen

>>>>> "EZ" == Eli Zaretskii <eliz@gnu.org> writes:

    >> >From 13e47efe3c15e7afe3f6db98681e31125d199f58 Mon Sep 17
    >> 00:00:00 2001 From: Mohsen Banan <form@mohsen.banan.1.byname.net>
    >> Date: Wed, 26 Apr 2023 18:35:13 -0700 Subject: [PATCH] Reviving
    >> qmail with X-Message-SMTP-Method in Gnus
    >> 
    >> --- lisp/gnus/message.el | 2 ++ 1 file changed, 2 insertions(+)
    >> 
    >> diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index
    >> 7a71ac9f58e..865e5c99000 100644 --- a/lisp/gnus/message.el +++
    >> b/lisp/gnus/message.el @@ -5017,6 +5017,8 @@
    >> message-multi-smtp-send-mail (cond ((equal (car method)
    >> "sendmail") (message-send-mail-with-sendmail)) + ((equal (car
    >> method) "qmail") + (message-send-mail-with-qmail)) ((equal (car
    >> method) "smtp") (require 'smtpmail) (let*
    >> ((smtpmail-store-queue-variables t) -- 2.30.2

    EZ> Andrew, Lars: any objections to adding this to message.el?

Err, yes I object (sort of)! message.el knows how to handle 4 MTAs:
sendmail, qmail, mh, and mailclient.  The header X-Message-SMTP-Method
can be used to override the default MTA but for some reason only allows
sendmail (or the use of smtp directly).  The suggested patch would also
allow qmail. But the better way to handle this is to allow any of the
MTAs to be used. I suggest the following patch instead which will do
this (and in the unlikely event that another MTA is added to message.el
it would not require any further modification to handle the new MTA). Unless
there is some objection I'll push this instead.

From bc25ec11c0c56ccf0d57adec839e5c640f97b725 Mon Sep 17 00:00:00 2001
From: Andrew G Cohen <cohen@andy.bu.edu>
Date: Wed, 3 May 2023 11:37:45 +0800
Subject: [PATCH 2/2] Allow X-Message-SMTP-Method to include more MTAs

* lisp/gnus/message.el (message-multi-smtp-send-mail): Allow the
X-Message-SMTP-Method header to override the default mailer with not
only smtp and sendmail but other MTAs as well.
---
 lisp/gnus/message.el | 38 +++++++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 8d3fe010af4..3f7ce06f365 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -5007,30 +5007,34 @@ message-multi-smtp-send-mail
   "Send the current buffer to `message-send-mail-function'.
 Or, if there's a header that specifies a different method, use
 that instead."
-  (let ((method (message-field-value "X-Message-SMTP-Method")))
+  (let ((method (message-field-value "X-Message-SMTP-Method"))
+        send-function)
     (if (not method)
-	(funcall message-send-mail-function)
+        (funcall message-send-mail-function)
       (message-remove-header "X-Message-SMTP-Method")
       (setq method (split-string method))
+      (setq send-function
+            (symbol-function
+             (intern-soft (format "message-send-mail-with-%s" (car method)))))
       (cond
-       ((equal (car method) "sendmail")
-	(message-send-mail-with-sendmail))
        ((equal (car method) "smtp")
-	(require 'smtpmail)
-	(let* ((smtpmail-store-queue-variables t)
+        (require 'smtpmail)
+        (let* ((smtpmail-store-queue-variables t)
                (smtpmail-smtp-server (nth 1 method))
-	       (service (nth 2 method))
-	       (port (string-to-number service))
-	       ;; If we're talking to the TLS SMTP port, then force a
-	       ;; TLS connection.
-	       (smtpmail-stream-type (if (= port 465)
-					 'tls
-				       smtpmail-stream-type))
-	       (smtpmail-smtp-service (if (> port 0) port service))
-	       (smtpmail-smtp-user (or (nth 3 method) smtpmail-smtp-user)))
-	  (message-smtpmail-send-it)))
+               (service (nth 2 method))
+               (port (string-to-number service))
+               ;; If we're talking to the TLS SMTP port, then force a
+               ;; TLS connection.
+               (smtpmail-stream-type (if (= port 465)
+                                         'tls
+                                       smtpmail-stream-type))
+               (smtpmail-smtp-service (if (> port 0) port service))
+               (smtpmail-smtp-user (or (nth 3 method) smtpmail-smtp-user)))
+          (message-smtpmail-send-it)))
+       (send-function
+        (funcall send-function))
        (t
-	(error "Unknown method %s" method))))))
+        (error "Unknown mail method %s" method))))))
 
 (defun message-send-mail-with-sendmail ()
   "Send off the prepared buffer with sendmail."
-- 
2.40.0




-- 
Andrew Cohen



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] Reviving qmail with X-Message-SMTP-Method in Gnus
  2023-05-04  7:32   ` Andrew Cohen
@ 2023-05-04  8:03     ` Eli Zaretskii
  2023-05-04 16:02     ` Mohsen BANAN
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2023-05-04  8:03 UTC (permalink / raw)
  To: Andrew Cohen; +Cc: emacs, cohen, emacs-devel, larsi

> From: Andrew Cohen <acohen@ust.hk>
> Cc: Mohsen BANAN <emacs@mohsen.1.banan.byname.net>,  Andrew Cohen
>  <cohen@bu.edu>,  emacs-devel@gnu.org,  Lars Ingebrigtsen <larsi@gnus.org>
> Date: Thu, 04 May 2023 15:32:04 +0800
> 
> >>>>> "EZ" == Eli Zaretskii <eliz@gnu.org> writes:
> 
>     EZ> Andrew, Lars: any objections to adding this to message.el?
> 
> Err, yes I object (sort of)! message.el knows how to handle 4 MTAs:
> sendmail, qmail, mh, and mailclient.  The header X-Message-SMTP-Method
> can be used to override the default MTA but for some reason only allows
> sendmail (or the use of smtp directly).  The suggested patch would also
> allow qmail. But the better way to handle this is to allow any of the
> MTAs to be used. I suggest the following patch instead which will do
> this (and in the unlikely event that another MTA is added to message.el
> it would not require any further modification to handle the new MTA). Unless
> there is some objection I'll push this instead.

Fine with me, but please install that on the master branch, not on
emacs-29.

Thanks.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Reviving qmail with X-Message-SMTP-Method in Gnus
  2023-05-04  7:32   ` Andrew Cohen
  2023-05-04  8:03     ` Eli Zaretskii
@ 2023-05-04 16:02     ` Mohsen BANAN
  2023-05-05  0:12       ` Andrew Cohen
  1 sibling, 1 reply; 7+ messages in thread
From: Mohsen BANAN @ 2023-05-04 16:02 UTC (permalink / raw)
  To: Andrew Cohen; +Cc: Eli Zaretskii, Andrew Cohen, emacs-devel, Lars Ingebrigtsen


Andrew Cohen <acohen@ust.hk> writes:
>>>>>> "EZ" == Eli Zaretskii <eliz@gnu.org> writes:
>
>     EZ> Andrew, Lars: any objections to adding this to message.el?
>
> Err, yes I object (sort of)! message.el knows how to handle 4 MTAs:
> sendmail, qmail, mh, and mailclient.  The header X-Message-SMTP-Method
> can be used to override the default MTA but for some reason only allows
> sendmail (or the use of smtp directly).  The suggested patch would also
> allow qmail. But the better way to handle this is to allow any of the
> MTAs to be used. I suggest the following patch instead which will do
> this (and in the unlikely event that another MTA is added to message.el
> it would not require any further modification to handle the new MTA). Unless
> there is some objection I'll push this instead.

Both patches will reactive qmail -- which is what
I want. So, as far as I am concerned, either is
good.

But, Andrew I want you to consider this.

Perhaps Lars did it on purpose. Perhaps he
included sendmail and excluded qmail, mh, and
mailclient on purpose believing that those other MTAs
are no longer in use. Expecting people to complain
if that was not the case.

I am actually using qmail. So, there is a use
case for qmail. I am saying that qmail is not
obsolete. I have added oauth2 support for qmail
and I use qmail to access gmail ...

But is anybody actually using mh or mailclient?
What we do know is that nobody has complained
about them not being supported for a while.
So perhaps nobody is actually using mh ...

In other words, perhaps it is the right thing for
emacs to move towards considering mh as on its way
to be obsoleted.

In any case, in addition to the code,
documentation also needs to be update. I mentioned
that in my submission.

Again, from may perspective your patch is equally fine.

Had you considered that planned obsolescence
strategy in your patch?

Thanks and regards,

...Mohsen



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Reviving qmail with X-Message-SMTP-Method in Gnus
  2023-05-04 16:02     ` Mohsen BANAN
@ 2023-05-05  0:12       ` Andrew Cohen
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Cohen @ 2023-05-05  0:12 UTC (permalink / raw)
  To: Mohsen BANAN; +Cc: Eli Zaretskii, Andrew Cohen, emacs-devel, Lars Ingebrigtsen

>>>>> "MB" == Mohsen BANAN <emacs@mohsen.1.banan.byname.net> writes:

[...]

    MB> Both patches will reactive qmail -- which is what I want. So, as
    MB> far as I am concerned, either is good.

    MB> But, Andrew I want you to consider this.

[...]

    MB> Had you considered that planned obsolescence strategy in your
    MB> patch?

Yes! That is the primary motivation for the patch---you may have noticed
that it doesn't mention qmail (or sendmail, or any other particular
mailer). The issue I had with the current code is that it special-cases
one mailer (or two if we were to add qmail), which makes maintenance
harder. By moving to something generic we can now add new MTAs, or
remove obsolete ones as you suggest, without having to worry about this
part of the code, which will just do the right thing.

In any case I have heard no objections so I'll go ahead and push
it. Thanks for bringing this issue up and improving Emacs!

-- 
Andrew Cohen



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-05-05  0:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-27  2:05 [PATCH] Reviving qmail with X-Message-SMTP-Method in Gnus Mohsen BANAN
2023-04-27  6:00 ` Eli Zaretskii
2023-05-04  6:46 ` Eli Zaretskii
2023-05-04  7:32   ` Andrew Cohen
2023-05-04  8:03     ` Eli Zaretskii
2023-05-04 16:02     ` Mohsen BANAN
2023-05-05  0:12       ` Andrew Cohen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.