]> code.delx.au - gnu-emacs/blobdiff - lisp/mail/mailpost.el
(rmail-summary-previous-msg): Add docstring.
[gnu-emacs] / lisp / mail / mailpost.el
index 0a7c4e0a1d187eea2ad0360976b33366c75baf44..f8198c9e97d5127ea88e602ebe1726926f7cbbd4 100644 (file)
@@ -1,25 +1,36 @@
-;;
-;; P O S T . E L
-;;
+;;; mailpost.el --- RMAIL coupler to /usr/uci/post mailer
+
+;; This is in the public domain
+;; since Delp distributed it without a copyright notice in 1986.
+
+;; This file is part of GNU Emacs.
+
+;; Author: Gary Delp <delp@huey.Udel.Edu>
+;; Maintainer: FSF
+;; Created: 13 Jan 1986
+;; Keywords: mail
+
+;;; Commentary:
+
 ;; Yet another mail interface.  this for the rmail system to provide
 ;;  the missing sendmail interface on systems without /usr/lib/sendmail,
 ;;   but with /usr/uci/post.
-;;
-;; created by: Gary Delp <delp at huey.Udel.Edu>
-;;             Mon Jan 13 14:45:12 1986
-;;
-;;
+
+;;; Code:
+
+(require 'mailalias)
+(require 'sendmail)
 
 ;; (setq send-mail-function 'post-mail-send-it)
 
 (defun post-mail-send-it ()
-  "\
-the MH -post interface for rmail-mail to call.
-to use it, include (setq send-mail-function 'post-mail-send-it) in site-init."
+  "The MH -post interface for `rmail-mail' to call.
+To use it, include \"(setq send-mail-function 'post-mail-send-it)\" in
+site-init."
   (let ((errbuf (if mail-interactive
                    (generate-new-buffer " post-mail errors")
                  0))
-       (temfile "/tmp/,rpost")
+       temfile
        (tembuf (generate-new-buffer " post-mail temp"))
        (case-fold-search nil)
        delimline
@@ -34,10 +45,7 @@ to use it, include (setq send-mail-function 'post-mail-send-it) in site-init."
          (or (= (preceding-char) ?\n)
              (insert ?\n))
          ;; Change header-delimiter to be what post-mail expects.
-         (goto-char (point-min))
-         (search-forward (concat "\n" mail-header-separator "\n"))
-         (replace-match "\n\n")
-         (backward-char 1)
+         (mail-sendmail-undelimit-header)
          (setq delimline (point-marker))
          (if mail-aliases
              (expand-mail-aliases (point-min) delimline))
@@ -68,8 +76,12 @@ to use it, include (setq send-mail-function 'post-mail-send-it) in site-init."
                (save-excursion
                  (set-buffer errbuf)
                  (erase-buffer))))
-         (write-file (setq temfile (make-temp-name temfile)))
-         (set-file-modes temfile 384)
+         (let ((m (default-file-modes)))
+           (unwind-protect
+               (progn
+                 (set-default-file-modes 384)
+                 (setq temfile  (make-temp-file ",rpost")))
+             (set-default-file-modes m)))
          (apply 'call-process
                 (append (list (if (boundp 'post-mail-program)
                                   post-mail-program
@@ -90,3 +102,7 @@ to use it, include (setq send-mail-function 'post-mail-send-it) in site-init."
       (kill-buffer tembuf)
       (if (bufferp errbuf)
          (switch-to-buffer errbuf)))))
+
+(provide 'mailpost)
+
+;;; mailpost.el ends here