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

Sympathy for the Devil, er, Hand



Does anyone know how to specify abbreviations for *unknown* mail
addresses in ZMAIL?  Suppose that you wanted to send mail to symbolics,

customer-reports at riverside.scrc.symbolics.com

and your hand wasn't psyched to type all that nonsense; instead, all it
wanted to type was

lispm-bug

However, my local LISP machine doesn't know about the host
"riverside.scrc.symbolics.com."  Only the local Mail courier, otherwise
known as a hacked mailer on a 3rd-party machine, knows about this
address.  When I try to define LISPM-BUG as a mailing list in the
mailer's MAILBOXES.TEXT file,

;; ergo
(define lispm-bug "customer-reports at riverside.scrc.symbolics.com")

the Mailer dies (or for that matter, it never finishes booting) while
trying to parse this host.  Ideally, it'd be nice if the mailer could
automatically substitute one string for another (much like Word Abbrevs
in ZWEI) before trying to send a message with an abbreviated name.
Right now it 1appears0 as though the local mailer must know about all
destinations.

Any suggestions?

Thanks,
Scott

P.S. Here's a hack that makes a first attempt at avoiding the "unknown"
host syndrome.  When a mailer chokes on an address, this hack tries
subsequent mailers until either (1) the mail is successfully sent, or
(2) everyone chokes on the address.

1;;; This hack resends mail via other serviceable hosts when the
;;; recipient host isn't known.

0(in-package 'zwei)

(defmacro 2nil-if-unknown-host0 (&body body)
  `(condition-case (err)
     (progn ,@body t)
     (zwei:send-it-fails-for-recipient nil)))

(advise network-send-it-1 :around2 resend-mail-if-unknown-host0 nil
  (destructuring-bind (services recipients template) arglist
    (loop with flag = nil
      for service in services
      until flag
      finally (return
            (cond ((null flag)
               (setf arglist (list services recipients template))
               :do-it)
              (t t)))
      do
      (setf arglist (list (ncons service) recipients template))
      (setq flag (nil-if-unknown-host :do-it))
      (when (null flag)
    (typein-line (format nil "~&Unable to use ~A; trying another host.~%" service))))))

(defvar2 *sorted-post-offices*
0    (mapcar #'neti:parse-host '("larry" "moe" "curly""))
  "A sorted list of hosts that can act as store-and-forward mailers.")

(advise 2find-sorted-mail-services0 :around use-preferred-post-offices nil
  (cond ((not (null *sorted-post-offices*))
     (setf values (loop for post-office in *sorted-post-offices*
                for path = (ignore-errors
                     (neti:find-path-to-service-on-host
                       :store-and-forward-mail post-office))
                when path collect path)))
    (t :do-it)))