[gnus git] branch master updated: m0-1-55-ge17e9b8 =2= Implement the X-Message-SMTP-Method Message header ; Adjust Message mail sending to allow multi-SMTP sending.

Lars Ingebrigtsen <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  e17e9b8fded888ad43b32cf0c1dd09028de1390b (commit)
       via  9e14eb0c8aaa5691f708a6a64a4eafe33b00501d (commit)
      from  16b9dfbbeff811d8e55e60005d91e350103702a3 (commit)


- Log -----------------------------------------------------------------
commit e17e9b8fded888ad43b32cf0c1dd09028de1390b
Author: Lars Ingebrigtsen <[email protected]>
Date:   Thu Feb 2 14:24:08 2012 +0100

    Implement the X-Message-SMTP-Method Message header
    
    * lisp/message.el (message-multi-smtp-send-mail): New function.
    (message-multi-smtp-send-mail): Respect the X-Message-SMTP-Method
    header to implement multi-SMTP functionality.
    
    * texi/message.texi (Mail Variables): Document X-Message-SMTP-Method.

diff --git a/GNUS-NEWS b/GNUS-NEWS
index f7bcd56..a580890 100644
--- a/GNUS-NEWS
+++ b/GNUS-NEWS
@@ -20,6 +20,11 @@ For older news, see Gnus info node "New Features".
 ** `backtab' in the summary buffer now selects the previous link in
    the article buffer.
 
+** Using the "X-Message-SMTP-Method" header in Message buffers now
+   allows specifying how messages are to be sent.  For example:
+
+   X-Message-SMTP-Method: smtp smtp.fsf.org 587
+   
 * For older news, see Gnus info node "New Features".
 
 ----------------------------------------------------------------------
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3ccc906..6552159 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,6 +1,8 @@
 2012-02-02  Lars Ingebrigtsen  <[email protected]>
 
 	* message.el (message-multi-smtp-send-mail): New function.
+	(message-multi-smtp-send-mail): Respect the X-Message-SMTP-Method
+	header to implement multi-SMTP functionality.
 
 	* gnus-agent.el (gnus-agent-send-mail-function): Removed.
 	(gnus-agentize): Don't set it.
diff --git a/lisp/message.el b/lisp/message.el
index e7bbff6..e925e8c 100644
--- a/lisp/message.el
+++ b/lisp/message.el
@@ -4707,7 +4707,20 @@ If you always want Gnus to send messages in one piece, set
   "Send the current buffer to `message-send-mail-function'.
 Or, if there's a header that specifies a different method, use
 that instead."
-  (funcall message-send-mail-function))
+  (let ((method (message-field-value "X-Message-SMTP-Method")))
+    (if (not method)
+	(funcall message-send-mail-function)
+      (message-remove-header "X-Message-SMTP-Method")
+      (setq method (split-string method))
+      (cond
+       ((equal (car method) "sendmail")
+	(message-send-mail-with-sendmail))
+       ((equal (car method) "smtp")
+	(let ((smtpmail-smtp-server (nth 1 method))
+	      (smtpmail-smtp-service (nth 2 method)))
+	  (message-smtpmail-send-it)))
+       (t
+	(error "Unknown method %s" method))))))
 
 (defun message-send-mail-with-sendmail ()
   "Send off the prepared buffer with sendmail."
diff --git a/texi/ChangeLog b/texi/ChangeLog
index 1884376..c573ee7 100644
--- a/texi/ChangeLog
+++ b/texi/ChangeLog
@@ -1,3 +1,7 @@
+2012-02-02  Lars Ingebrigtsen  <[email protected]>
+
+	* message.texi (Mail Variables): Document X-Message-SMTP-Method.
+
 2012-01-31  Lars Ingebrigtsen  <[email protected]>
 
 	* gnus.texi (Key Index): Change encoding to utf-8.
diff --git a/texi/message.texi b/texi/message.texi
index f3ec8f8..cc3cadf 100644
--- a/texi/message.texi
+++ b/texi/message.texi
@@ -1641,6 +1641,32 @@ To the thing similar to this, there is
 requires the @acronym{POP}-before-@acronym{SMTP} authentication.
 @xref{POP before SMTP, , POP before SMTP, gnus, The Gnus Manual}.
 
+@cindex X-Message-SMTP-Method
+If you have a complex @acronym{SMTP} setup, and want some messages to
+go via one mail server, and other messages to go through another, you
+can use the @samp{X-Message-SMTP-Method} header.  These are the
+supported values:
+
+@table @samp
+@item smtpmail
+
+@example
+X-Message-SMTP-Method: smtp smtp.fsf.org 587
+@end example
+
+This will send the message via @samp{smtp.fsf.org}, using port 587.
+
+@item sendmail
+
+@example
+X-Message-SMTP-Method: sendmail
+@end example
+
+This will send the message via the locally installed sendmail/exim/etc
+installation.
+
+@end table
+
 @item message-mh-deletable-headers
 @vindex message-mh-deletable-headers
 Most versions of MH doesn't like being fed messages that contain the

commit 9e14eb0c8aaa5691f708a6a64a4eafe33b00501d
Author: Lars Ingebrigtsen <[email protected]>
Date:   Thu Feb 2 14:08:52 2012 +0100

    Adjust Message mail sending to allow multi-SMTP sending.
    
    * gnus-agent.el (gnus-agent-send-mail-function): Removed.
    (gnus-agentize): Don't set it.
    (gnus-agent-send-mail): Don't use it.
    
    * message.el (message-multi-smtp-send-mail): New function.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4905dbe..3ccc906 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,11 @@
 2012-02-02  Lars Ingebrigtsen  <[email protected]>
 
+	* message.el (message-multi-smtp-send-mail): New function.
+
+	* gnus-agent.el (gnus-agent-send-mail-function): Removed.
+	(gnus-agentize): Don't set it.
+	(gnus-agent-send-mail): Don't use it.
+
 	* gnus-sum.el (gnus-summary-widget-backward): New function and
 	keystroke.
 
diff --git a/lisp/gnus-agent.el b/lisp/gnus-agent.el
index 5178220..284a378 100644
--- a/lisp/gnus-agent.el
+++ b/lisp/gnus-agent.el
@@ -242,7 +242,6 @@ NOTES:
 (defvar gnus-category-group-cache nil)
 (defvar gnus-agent-spam-hashtb nil)
 (defvar gnus-agent-file-name nil)
-(defvar gnus-agent-send-mail-function nil)
 (defvar gnus-agent-file-coding-system 'raw-text)
 (defvar gnus-agent-file-loading-cache nil)
 (defvar gnus-agent-total-fetched-hashtb nil)
@@ -683,11 +682,7 @@ This will modify the `gnus-setup-news-hook', and
 minor mode in all Gnus buffers."
   (interactive)
   (gnus-open-agent)
-  (unless gnus-agent-send-mail-function
-    (setq gnus-agent-send-mail-function
-	  (or message-send-mail-real-function
-	      (function (lambda () (funcall message-send-mail-function))))
-	  message-send-mail-real-function 'gnus-agent-send-mail))
+  (setq message-send-mail-real-function 'gnus-agent-send-mail)
 
   ;; If the servers file doesn't exist, auto-agentize some servers and
   ;; save the servers file so this auto-agentizing isn't invoked
@@ -723,7 +718,7 @@ Optional arg GROUP-NAME allows to specify another group."
 (defun gnus-agent-send-mail ()
   (if (or (not gnus-agent-queue-mail)
 	  (and gnus-plugged (not (eq gnus-agent-queue-mail 'always))))
-      (funcall gnus-agent-send-mail-function)
+      (message-multi-smtp-send-mail)
     (goto-char (point-min))
     (re-search-forward
      (concat "^" (regexp-quote mail-header-separator) "\n"))
diff --git a/lisp/message.el b/lisp/message.el
index acd546a..e7bbff6 100644
--- a/lisp/message.el
+++ b/lisp/message.el
@@ -4535,8 +4535,9 @@ This function could be useful in `message-setup-hook'."
 	      (end-of-line)
 	      (insert (format " (%d/%d)" n total))
 	      (widen)
-              (funcall (or message-send-mail-real-function
-                           message-send-mail-function)))
+	      (if message-send-mail-real-function
+		  (funcall message-send-mail-real-function)
+		(message-multi-smtp-send-mail)))
 	    (setq n (+ n 1))
 	    (setq p (pop plist))
 	    (erase-buffer)))
@@ -4690,8 +4691,9 @@ If you always want Gnus to send messages in one piece, set
 ")))
 	      (progn
 		(message "Sending via mail...")
-		(funcall (or message-send-mail-real-function
-			     message-send-mail-function)))
+		(if message-send-mail-real-function
+		    (funcall message-send-mail-real-function)
+		  (message-multi-smtp-send-mail)))
 	    (message-send-mail-partially))
 	  (setq options message-options))
       (kill-buffer tembuf))
@@ -4701,6 +4703,12 @@ If you always want Gnus to send messages in one piece, set
 
 (defvar sendmail-program)
 
+(defun 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."
+  (funcall message-send-mail-function))
+
 (defun message-send-mail-with-sendmail ()
   "Send off the prepared buffer with sendmail."
   (require 'sendmail)

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 GNUS-NEWS          |    5 +++++
 lisp/ChangeLog     |    8 ++++++++
 lisp/gnus-agent.el |    9 ++-------
 lisp/message.el    |   29 +++++++++++++++++++++++++----
 texi/ChangeLog     |    4 ++++
 texi/message.texi  |   26 ++++++++++++++++++++++++++
 6 files changed, 70 insertions(+), 11 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.