Function: message-multi-smtp-send-mail

message-multi-smtp-send-mail is a byte-compiled function defined in message.el.gz.

Signature

(message-multi-smtp-send-mail)

Documentation

Send the current buffer to message-send-mail-function(var)/message-send-mail-function(fun).

Or, if there's a header that specifies a different method, use that instead.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/message.el.gz
(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."
  (let ((method (message-field-value "X-Message-SMTP-Method"))
        send-function)
    (if (not method)
        (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) "smtp")
        (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)))
       (send-function
        (funcall send-function))
       (t
        (error "Unknown mail method %s" method))))))