Function: gnus-draft-send

gnus-draft-send is a byte-compiled function defined in gnus-draft.el.gz.

Signature

(gnus-draft-send ARTICLE &optional GROUP INTERACTIVE)

Documentation

Send message ARTICLE.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-draft.el.gz
(defun gnus-draft-send (article &optional group interactive)
  "Send message ARTICLE."
  (let* ((is-queue (or (not group)
                       (equal group "nndraft:queue")))
         (message-syntax-checks (if interactive message-syntax-checks
                                  'dont-check-for-anything-just-trust-me))
         (message-hidden-headers nil)
         (message-inhibit-body-encoding (or is-queue
                                            message-inhibit-body-encoding))
         (message-send-hook (and (not is-queue)
                                 message-send-hook))
         (message-setup-hook (and (not is-queue)
                                  message-setup-hook))
	 (gnus-message-setup-hook (and (not is-queue)
				       gnus-message-setup-hook))
	 (message-signature (and (not is-queue)
				 message-signature))
         (gnus-agent-queue-mail (and (not is-queue)
                                     gnus-agent-queue-mail))
	 (rfc2047-encode-encoded-words nil)
         type method move-to)
    (gnus-draft-setup article (or group "nndraft:queue") nil 'dont-pop)
    ;; We read the meta-information that says how and where
    ;; this message is to be sent.
    (save-restriction
      (message-narrow-to-headers)
      (when (re-search-forward
	     (concat "^" (regexp-quote gnus-agent-target-move-group-header)
		     ":") nil t)
	(skip-syntax-forward "-")
	(setq move-to (buffer-substring (point) (point-at-eol)))
	(message-remove-header gnus-agent-target-move-group-header))
      (goto-char (point-min))
      (when (re-search-forward
	     (concat "^" (regexp-quote gnus-agent-meta-information-header) ":")
	     nil t)
	(setq type (ignore-errors (read (current-buffer)))
	      method (ignore-errors (read (current-buffer))))
	(message-remove-header gnus-agent-meta-information-header)))
    ;; Let Agent restore any GCC lines and have message.el perform them.
    (gnus-agent-restore-gcc)
    ;; Then we send it.  If we have no meta-information, we just send
    ;; it and let Message figure out how.
    (when (and (or (null method)
		   (gnus-server-opened method)
		   (gnus-open-server method))
	       (if type
		   (let ((message-this-is-news (eq type 'news))
			 (message-this-is-mail (eq type 'mail))
			 (gnus-post-method method)
			 (message-post-method method))
		     (if move-to
			 (gnus-inews-do-gcc move-to)
		       (message-send-and-exit)))
		 (if move-to
		     (gnus-inews-do-gcc move-to)
		   (message-send-and-exit))))
      (let ((gnus-verbose-backends nil))
	(gnus-request-expire-articles
	 (list article) (or group "nndraft:queue") t)))))