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. * doc/misc/message.texi: Document changes to the usage of X-Message-SMTP-Method.
This commit is contained in:
parent
8d1332d135
commit
f261226d9b
2 changed files with 31 additions and 26 deletions
|
@ -1948,11 +1948,9 @@ requires the @acronym{POP}-before-@acronym{SMTP} authentication.
|
|||
@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
|
||||
can use the @samp{X-Message-SMTP-Method} header to override the
|
||||
default by using the keyword @samp{smtp} followed by the server
|
||||
information:
|
||||
|
||||
@example
|
||||
X-Message-SMTP-Method: smtp smtp.fsf.org 587
|
||||
|
@ -1968,16 +1966,19 @@ This is the same as the above, but uses @samp{other-user} as the user
|
|||
name when authenticating. This is handy if you have several
|
||||
@acronym{SMTP} accounts on the same server.
|
||||
|
||||
@item sendmail
|
||||
This header may also be used to specify an alternative MTA by using a
|
||||
@samp{mailer} keyword, where @samp{mailer} is the name of an MTA with
|
||||
a corresponding @code{message-send-mail-with-'mailer'} function. For
|
||||
example:
|
||||
|
||||
@example
|
||||
X-Message-SMTP-Method: sendmail
|
||||
@end example
|
||||
|
||||
This will send the message via the locally installed sendmail/exim/etc
|
||||
installation.
|
||||
will send the message via the locally installed sendmail program. The
|
||||
recognized values of @samp{mailer} are sendmail, qmail, mh, and
|
||||
mailclient.
|
||||
|
||||
@end table
|
||||
|
||||
@item message-mh-deletable-headers
|
||||
@vindex message-mh-deletable-headers
|
||||
|
|
|
@ -5009,30 +5009,34 @@ Each line should be no more than 79 characters long."
|
|||
"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."
|
||||
|
|
Loading…
Add table
Reference in a new issue