Function: message-send-mail-with-qmail

message-send-mail-with-qmail is a byte-compiled function defined in message.el.gz.

Signature

(message-send-mail-with-qmail)

Documentation

Pass the prepared message buffer to qmail-inject.

Refer to the documentation for the variable message-send-mail-function(var)/message-send-mail-function(fun) to find out how to use this.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/message.el.gz
(defun message-send-mail-with-qmail ()
  "Pass the prepared message buffer to qmail-inject.
Refer to the documentation for the variable `message-send-mail-function'
to find out how to use this."
  ;; replace the header delimiter with a blank line
  (goto-char (point-min))
  (re-search-forward
   (concat "^" (regexp-quote mail-header-separator) "\n"))
  (replace-match "\n")
  (run-hooks 'message-send-mail-hook)
  ;; send the message
  (pcase
      (let ((coding-system-for-write message-send-coding-system))
	(apply
	 #'call-process-region (point-min) (point-max)
	 message-qmail-inject-program nil nil nil
	 ;; qmail-inject's default behavior is to look for addresses on the
	 ;; command line; if there're none, it scans the headers.
	 ;; yes, it does The Right Thing w.r.t. Resent-To and its kin.
	 ;;
	 ;; in general, ALL of qmail-inject's defaults are perfect for simply
	 ;; reading a formatted (i. e., at least a To: or Resent-To header)
	 ;; message from stdin.
	 ;;
	 ;; qmail also has the advantage of not having been raped by
	 ;; various vendors, so we don't have to allow for that, either --
	 ;; compare this with message-send-mail-with-sendmail and weep
	 ;; for sendmail's lost innocence.
	 ;;
	 ;; all this is way cool coz it lets us keep the arguments entirely
	 ;; free for -inject-arguments -- a big win for the user and for us
	 ;; since we don't have to play that double-guessing game and the user
	 ;; gets full control (no gestapo'ish -f's, for instance).  --sj
	 (if (functionp message-qmail-inject-args)
	     (funcall message-qmail-inject-args)
	   message-qmail-inject-args)))
    ;; qmail-inject doesn't say anything on its stdout/stderr,
    ;; we have to look at the retval instead
    (0 nil)
    (100 (error "qmail-inject reported permanent failure"))
    (111 (error "qmail-inject reported transient failure"))
    ;; should never happen
    (_   (error "qmail-inject reported unknown failure"))))