[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ZMAIL Reply to MMAILR failures



The ZMAIL manual, in the section entitled "Zmail Reply Command", documents the
following feature:
    
    Replying to a COMSAT or XMAILR (mail server) message retries
    the failed message, rather than replying to anything. If the
    problem is a nonexistent address at another host, you are
    prompted to supply a corrected address.

COMSAT is the MIT ITS mail server.  XMAILR is an old Tops-20 mail server.
Tops-20 sites that use the MMAILR mailer may want to install this patch
to teach ZMAIL about an additional format of mail rejection:

========================= cut here =========================
;;;-*- Mode:LISP; Package:ZWEI; Base:8 -*-
;;; Patch for ZMAIL (written under Genera 7.1)
;;; Bob Kanefsky, Schlumberger Palo Alto Research, Kanef@SPAR-20.ARPA

;;;Make it try the function below, as well as the ones for COMSAT, XMAILR, etc.
(cl:pushnew 'zwei:mmailr-rejection-p zwei:*failed-mail-predicates* :localize t)

(defun mmailr-rejection-p (msg &aux start-bp end-bp failed-msg-start-bp failed-recipients)
  (when (and (let ((from (car (msg-get msg ':from))))
	       (equal (get (locf from) ':name) "Mailer"))
	     (setq failed-msg-start-bp (search (setq start-bp (msg-start-bp msg))
					       "
	    ------------
"
					       nil nil nil (setq end-bp (msg-end-bp msg)))))
    (barf-on-errors (parse-error)
      (do ((line (line-next (bp-line (or (search start-bp "Message failed for the following:" nil nil nil end-bp)
					 (return-from mmailr-rejection-p 'nil))))
		 (line-next line))
	   (end-line (bp-line failed-msg-start-bp))
	   (idx))
	  ((eq line end-line))
	(when (string-search "@" line)
	  (setq idx (string-search ": " line))
	  (when idx (setq failed-recipients (append failed-recipients (parse-addresses line 0 idx)))))))
    (values t failed-msg-start-bp end-bp failed-recipients)))

========================= cut here =========================

By the way, two corrections to the above documentation:
   1.  UNIX failure messages are also apparently recognized -- the
       kind that say "----- Transcript of session follows -----".
   2.  I don't think it ever prompts you for corrected addresses.
       It just generates a "To" line with the bad ones, and positions
       the cursor there so you can edit them.

					--Kanef