From: Reiner Steib <reinersteib+gmane@imap.cc>
To: Stefan Monnier <monnier@iro.umontreal.ca>,
Dan Nicolaescu <dann@ics.uci.edu>
Cc: ding@gnus.org, emacs-devel@gnu.org
Subject: Default of message-send-mail-function (was: error from new Gnus / sendmail)
Date: Tue, 30 Oct 2007 23:55:19 +0100 [thread overview]
Message-ID: <v93avsdxgo.fsf@marauder.physik.uni-ulm.de> (raw)
In-Reply-To: <200710302106.l9UL6Fa1023166@oogie-boogie.ics.uci.edu> (Dan Nicolaescu's message of "Tue, 30 Oct 2007 14:06:15 -0700")
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/
next prev parent reply other threads:[~2007-10-30 22:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-30 21:06 error from new Gnus Dan Nicolaescu
2007-10-30 22:55 ` Reiner Steib [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=v93avsdxgo.fsf@marauder.physik.uni-ulm.de \
--to=reinersteib+gmane@imap.cc \
--cc=Reiner.Steib@gmx.de \
--cc=dann@ics.uci.edu \
--cc=ding@gnus.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.