From: Lars Ingebrigtsen Date: Thu, 2 Feb 2012 13:24:08 +0000 (+0100) Subject: Implement the X-Message-SMTP-Method Message header X-Git-Url: http://cgit.sxemacs.org/?a=commitdiff_plain;h=e17e9b8fded888ad43b32cf0c1dd09028de1390b;p=gnus 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 f7bcd56af..a580890de 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 3ccc9069f..6552159c0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,6 +1,8 @@ 2012-02-02 Lars Ingebrigtsen * 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 e7bbff675..e925e8cd8 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 188437614..c573ee747 100644 --- a/texi/ChangeLog +++ b/texi/ChangeLog @@ -1,3 +1,7 @@ +2012-02-02 Lars Ingebrigtsen + + * message.texi (Mail Variables): Document X-Message-SMTP-Method. + 2012-01-31 Lars Ingebrigtsen * gnus.texi (Key Index): Change encoding to utf-8. diff --git a/texi/message.texi b/texi/message.texi index f3ec8f8e3..cc3cadf8f 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