Gnus development mailing list
 help / color / mirror / Atom feed
* Default of message-send-mail-function (was: error from new Gnus / sendmail)
       [not found] <200710302106.l9UL6Fa1023166@oogie-boogie.ics.uci.edu>
@ 2007-10-30 22:55 ` Reiner Steib
  2007-10-31  1:07   ` Default of message-send-mail-function Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Reiner Steib @ 2007-10-30 22:55 UTC (permalink / raw)
  To: Stefan Monnier, Dan Nicolaescu; +Cc: ding, emacs-devel

On Mon, Oct 29 2007, Stefan Monnier wrote:
> I needed the following patch to get Emacs to use
> message-send-mail-with-sendmail like it used to.  Not sure if that's
> the right fix.

I'm also not sure about this.

> +(require 'sendmail)                     ;So as to define sendmail-program.
>  ;; Useful to set in site-init.el
>  (defcustom message-send-mail-function
>    (let ((program (if (boundp 'sendmail-program)

If we require sendmail, there's no point in testing (boundp
'sendmail-program).  Additionally, in
`message-send-mail-with-sendmail' there are more tests.

In March 2006 there was some discussion about this on ding/emacs-devel:
<http://thread.gmane.org/gmane.emacs.gnus.general/62284/focus=62290>.
Back then, I suggested:

--8<---------------cut here---------------start------------->8---
(defun message-send-mail-function ()
  "Return suitable value for the variable `message-send-mail-function'."
  (cond ((and sendmail-program
	      (executable-find sendmail-program))
	 'message-send-mail-with-sendmail)
	((and (locate-library "smtpmail")
	      (require 'smtpmail)
	      smtpmail-default-smtp-server)
	 'message-smtpmail-send-it)
	((locate-library "mailclient")
	 'message-send-mail-with-mailclient)
	(t
	 (lambda ()
	   (error "Don't know how to send mail.  Please customize `message-send-mail-function'.")))))
--8<---------------cut here---------------end--------------->8---

Below is a patch (with an earlier version of the function
`message-send-mail-function').  I will look at the old messages
tomorrow.  Unless there's a better suggestion, I'll install something
alone these lines.

On Tue, Oct 30 2007, Dan Nicolaescu wrote:
> Sending...
> Sending via mail...
> smtpmail-via-smtp: `smtpmail-smtp-server' not defined
>
> It worked fine before, mail was sent with the local sendmail, I don't
> have any special settings.  
>
> Shouldn't this continue to work by default?

Yes.  I wonder why nobody complained about this before.

Bye, Reiner.


--8<---------------cut here---------------start------------->8---
Index: message.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/gnus/message.el,v
retrieving revision 1.102
diff -u -r1.102 message.el
--- message.el	24 Feb 2006 05:02:12 -0000	1.102
+++ message.el	16 Mar 2006 21:09:33 -0000
@@ -48,6 +48,7 @@
 (require 'mml)
 (require 'rfc822)
 (eval-and-compile
+  (autoload 'mailclient-send-it "mailclient") ;; Emacs 22 or contrib/
   (autoload 'gnus-find-method-for-group "gnus")
   (autoload 'nnvirtual-find-group-art "nnvirtual")
   (autoload 'gnus-group-decoded-name "gnus-group"))
@@ -584,16 +585,37 @@
   :link '(custom-manual "(message)Canceling News")
   :type 'string)
 
+(defun message-send-mail-function ()
+  "Return suitable value for the variable `message-send-mail-function'."
+  (cond ((and sendmail-program
+	      (executable-find program))
+	 'message-send-mail-with-sendmail)
+	((and (locate-library "mailclient")
+	      window-system
+	      (memq system-type '(darwin windows-nt)))
+	 'message-send-mail-with-mailclient)
+	(t
+	 'message-smtpmail-send-it)))
+
+;; Prevent problems with `window-system' not having the correct value
+;; when loaddefs.el is loaded. `custom-reevaluate-setting' needs the
+;; standard value.
+;;;###autoload
+(put 'message-send-mail-function 'standard-value
+     '((message-send-mail-function)))
+
 ;; Useful to set in site-init.el
 ;;;###autoload
-(defcustom message-send-mail-function 'message-send-mail-with-sendmail
+(defcustom message-send-mail-function (message-send-mail-function)
   "Function to call to send the current buffer as mail.
 The headers should be delimited by a line whose contents match the
 variable `mail-header-separator'.
 
-Valid values include `message-send-mail-with-sendmail' (the default),
+Valid values include `message-send-mail-with-sendmail',
 `message-send-mail-with-mh', `message-send-mail-with-qmail',
-`message-smtpmail-send-it', `smtpmail-send-it' and `feedmail-send-it'.
+`message-smtpmail-send-it', `smtpmail-send-it',
+`feedmail-send-it' and `message-send-mail-with-mailclient'.  The
+default is system dependent.
 
 See also `send-mail-function'."
   :type '(radio (function-item message-send-mail-with-sendmail)
@@ -602,8 +624,11 @@
 		(function-item message-smtpmail-send-it)
 		(function-item smtpmail-send-it)
 		(function-item feedmail-send-it)
+		(function-item message-send-mail-with-mailclient
+			       :tag "Use Mailclient package")
 		(function :tag "Other"))
   :group 'message-sending
+  :initialize 'custom-initialize-default
   :link '(custom-manual "(message)Mail Variables")
   :group 'message-mail)
 
@@ -3982,6 +4007,13 @@
   (run-hooks 'message-send-mail-hook)
   (smtpmail-send-it))
 
+(defun message-send-mail-with-mailclient ()
+  "Send the prepared message buffer with `mailclient-send-it'.
+This only differs from `smtpmail-send-it' that this command evaluates
+`message-send-mail-hook' just before sending a message."
+  (run-hooks 'message-send-mail-hook)
+  (mailclient-send-it))
+
 (defun message-canlock-generate ()
   "Return a string that is non-trivial to guess.
 Do not use this for anything important, it is cryptographically weak."
--8<---------------cut here---------------end--------------->8---

-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

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

* Re: Default of message-send-mail-function
  2007-10-30 22:55 ` Default of message-send-mail-function (was: error from new Gnus / sendmail) Reiner Steib
@ 2007-10-31  1:07   ` Stefan Monnier
  2007-11-06 22:31     ` Reiner Steib
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2007-10-31  1:07 UTC (permalink / raw)
  To: Reiner Steib; +Cc: Dan Nicolaescu, ding, emacs-devel

> Below is a patch (with an earlier version of the function
> `message-send-mail-function').  I will look at the old messages
> tomorrow.  Unless there's a better suggestion, I'll install something
> alone these lines.

How 'bout initializing those vars to nil and then at the use-point
fallback to a heuristic that first tries mailclient, then sendmail,
then smtpmail (or some other order)?

Better yet: turn this var into a list of functions that are tried in turn.
This would make it possible to deal with the problem of window-system which
is not a constant any more.


        Stefan

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

* Re: Default of message-send-mail-function
  2007-10-31  1:07   ` Default of message-send-mail-function Stefan Monnier
@ 2007-11-06 22:31     ` Reiner Steib
  2007-11-20 21:00       ` Reiner Steib
  0 siblings, 1 reply; 4+ messages in thread
From: Reiner Steib @ 2007-11-06 22:31 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Dan Nicolaescu, ding, emacs-devel

On Wed, Oct 31 2007, Stefan Monnier wrote:

>> Below is a patch (with an earlier version of the function
>> `message-send-mail-function').  I will look at the old messages
>> tomorrow.  Unless there's a better suggestion, I'll install something
>> alone these lines.
>
> How 'bout initializing those vars to nil and then at the use-point
> fallback to a heuristic that first tries mailclient, then sendmail,
> then smtpmail (or some other order)?

There's also `message-send-mail-real-function' used in several files
(gnus-agent.el, gnus-soup.el, ...).  Sounds like work.
But if you'd like to implement it, please go ahead. :-)

> Better yet: turn this var into a list of functions that are tried in turn.
> This would make it possible to deal with the problem of window-system which
> is not a constant any more.

IIRC `window-system' was dropped later in the thread.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/



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

* Re: Default of message-send-mail-function
  2007-11-06 22:31     ` Reiner Steib
@ 2007-11-20 21:00       ` Reiner Steib
  0 siblings, 0 replies; 4+ messages in thread
From: Reiner Steib @ 2007-11-20 21:00 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Dan Nicolaescu, ding, emacs-devel

On Tue, Nov 06 2007, Reiner Steib wrote:

> On Wed, Oct 31 2007, Stefan Monnier wrote:
>
>>> Below is a patch (with an earlier version of the function
>>> `message-send-mail-function').  I will look at the old messages
>>> tomorrow.  Unless there's a better suggestion, I'll install something
>>> alone these lines.

I have installed a fix (in Emacs trunk).

>> How 'bout initializing those vars to nil and then at the use-point
>> fallback to a heuristic that first tries mailclient, then sendmail,
>> then smtpmail (or some other order)?
>
> There's also `message-send-mail-real-function' used in several files
> (gnus-agent.el, gnus-soup.el, ...).  Sounds like work.
> But if you'd like to implement it, please go ahead. :-)

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

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

end of thread, other threads:[~2007-11-20 21:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200710302106.l9UL6Fa1023166@oogie-boogie.ics.uci.edu>
2007-10-30 22:55 ` Default of message-send-mail-function (was: error from new Gnus / sendmail) Reiner Steib
2007-10-31  1:07   ` Default of message-send-mail-function Stefan Monnier
2007-11-06 22:31     ` Reiner Steib
2007-11-20 21:00       ` Reiner Steib

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).