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

mailing a file from lisp



;;; -*- Mode: LISP; Syntax: Common-lisp; Package: USER; Base: 10 -*-

;;; This file is being sent to you by use of the function defined below.  It 
;;; could easily be hacked to read file headers from the beginning of the file.

;;; This function takes a pathname as input, and reads a mail message from the file.
(defun zmail-send-file (pathname recipients from subject &rest other-headers)
  (apply #'zwei:send-message-string
	 recipients
	 (with-output-to-string (stream)
	   (with-open-file (file pathname :direction :input)
	     (loop for line = (read-line file nil nil)
		   while line doing (write-line line stream))))
	 :from from :subject subject
	 other-headers
	 ))
;;;