X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fmessage.el;h=f32981fbaa2a08821ce99ee5ec3e4c5f5603fba4;hb=afbf528d6fb2fdb90f56a50212e46178b869a28b;hp=556936303bc72aee54fdb664a782a76e53daf077;hpb=343c91739a9cc03258a193b62b10979427f6c7b0;p=gnus diff --git a/lisp/message.el b/lisp/message.el index 556936303..f32981fba 100644 --- a/lisp/message.el +++ b/lisp/message.el @@ -682,14 +682,16 @@ Done before generating the new subject of a forward." (t (error "Don't know how to send mail. Please customize `message-send-mail-function'")))) -;; Useful to set in site-init.el -(defcustom message-send-mail-function +(defun message-default-send-mail-function () (cond ((eq send-mail-function 'smtpmail-send-it) 'message-smtpmail-send-it) ((eq send-mail-function 'feedmail-send-it) 'feedmail-send-it) ((eq send-mail-function 'sendmail-query-once) 'sendmail-query-once) ((eq send-mail-function 'mailclient-send-it) 'message-send-mail-with-mailclient) - (t (message-send-mail-function))) + (t (message-send-mail-function)))) + +;; Useful to set in site-init.el +(defcustom message-send-mail-function (message-default-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'. @@ -1137,6 +1139,7 @@ probably want to set this variable only for specific groups, e.g. using `gnus-posting-styles': (eval (set (make-local-variable 'message-cite-reply-position) 'above))" + :version "24.1" :type '(choice (const :tag "Reply inline" 'traditional) (const :tag "Reply above" 'above) (const :tag "Reply below" 'below)) @@ -4535,8 +4538,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 +4694,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)) @@ -4700,6 +4705,28 @@ If you always want Gnus to send messages in one piece, set (push 'mail message-sent-message-via))) (defvar sendmail-program) +(defvar smtpmail-smtp-user) + +(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"))) + (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") + (require 'smtpmail) + (let ((smtpmail-smtp-server (nth 1 method)) + (smtpmail-smtp-service (nth 2 method)) + (smtpmail-smtp-user (or (nth 3 method) smtpmail-smtp-user))) + (message-smtpmail-send-it))) + (t + (error "Unknown method %s" method)))))) (defun message-send-mail-with-sendmail () "Send off the prepared buffer with sendmail." @@ -7586,7 +7613,7 @@ is for the internal use." (message "Resending message to %s..." address) (save-excursion (let ((cur (current-buffer)) - beg) + gcc beg) ;; We first set up a normal mail buffer. (unless (message-mail-user-agent) (set-buffer (get-buffer-create " *message resend*")) @@ -7599,6 +7626,8 @@ is for the internal use." ;; Insert our usual headers. (message-generate-headers '(From Date To Message-ID)) (message-narrow-to-headers) + (when (setq gcc (mail-fetch-field "gcc" nil t)) + (message-remove-header "gcc")) ;; Remove X-Draft-From header etc. (message-remove-header message-ignored-mail-headers t) ;; Rename them all to "Resent-*". @@ -7640,6 +7669,10 @@ is for the internal use." message-generate-hashcash rfc2047-encode-encoded-words) (message-send-mail)) + (when gcc + (message-goto-eoh) + (insert "Gcc: " gcc "\n")) + (run-hooks 'message-sent-hook) (kill-buffer (current-buffer))) (message "Resending message to %s...done" address)))