From jidzikowski at common-lisp.net Tue Sep 4 18:54:08 2007 From: jidzikowski at common-lisp.net (jidzikowski) Date: Tue, 4 Sep 2007 14:54:08 -0400 (EDT) Subject: [cl-smtp-cvs] CVS cl-smtp Message-ID: <20070904185408.3EBC02B12B@common-lisp.net> Update of /project/cl-smtp/cvsroot/cl-smtp In directory clnet:/tmp/cvs-serv31855 Modified Files: CHANGELOG INSTALL README cl-smtp.asd cl-smtp.lisp Removed Files: acl.lisp clisp.lisp cmucl.lisp lispworks.lisp openmcl.lisp sbcl.lisp Log Message: Remove implementation dependent sockets code by adding usocket dependency. --- /project/cl-smtp/cvsroot/cl-smtp/CHANGELOG 2006/04/04 13:04:40 1.5 +++ /project/cl-smtp/cvsroot/cl-smtp/CHANGELOG 2007/09/04 18:54:06 1.6 @@ -1,3 +1,10 @@ +Version 20070628.1 +2007-06-28 +Remove implementation dependent sockets code by adding usocket dependency. +Change cl-smtp.asd cl-smtp.lisp README INSTALL + (remove acl.lisp clisp.lisp cmucl.lisp sbcl.lisp lispworks.lisp openmcl.lisp) + + Version 20060404.1 2006-04-04 "ADD" support for attachment, thanks Brian Sorg for the implementation --- /project/cl-smtp/cvsroot/cl-smtp/INSTALL 2005/11/01 18:34:57 1.1.1.1 +++ /project/cl-smtp/cvsroot/cl-smtp/INSTALL 2007/09/04 18:54:06 1.2 @@ -1,10 +1,12 @@ -CL-SMTP works in ACL, SBCL, CMUCL, OPENMCL, LISPWORKS and CLISP. +CL-SMTP works in all implementations supported by its dependencies. -For SBCL you need sb-bsd-sockets. +For all implementations you'll need usocket +and cl-base64 (the latter isn't a requirement on ACL). CL-SMTP has a asdf system definition file. -load this file: + +To load this file: (asdf:operate 'asdf:load-op 'cl-smtp) --- /project/cl-smtp/cvsroot/cl-smtp/README 2006/05/24 10:46:22 1.5 +++ /project/cl-smtp/cvsroot/cl-smtp/README 2007/09/04 18:54:06 1.6 @@ -1,12 +1,12 @@ CL-SMTP is a simple lisp smtp client. -It works in ACL, SBCL, CMUCL, OPENMCL, LISPWORKS and CLISP. +It works in ACL, SBCL, CMUCL, OPENMCL, LISPWORKS, CLISP and ECL. new with support for send attachments, thanks Brian Sorg for the implementation with authentication support for PLAIN and LOGIN authentication method -used CL-BASE64 package +used cl-base64 and usocket packages (cl-base64 isn't a requirement on ACL) See INSTALL for prerequisites and build details. --- /project/cl-smtp/cvsroot/cl-smtp/cl-smtp.asd 2006/04/04 13:04:40 1.6 +++ /project/cl-smtp/cvsroot/cl-smtp/cl-smtp.asd 2007/09/04 18:54:06 1.7 @@ -20,32 +20,16 @@ (:use :cl :asdf) (:export :send-email)) -#+sbcl (require :sb-bsd-sockets) +(in-package :cl-smtp) +(defparameter *debug* nil) -(in-package :cl-smtp) +(defmacro print-debug (str) + `(when *debug* + (print ,str))) (asdf:defsystem :cl-smtp - :version "20060404.1" - :depends-on - #-allegro (:cl-base64) - #+allegro () - :components - (#+sbcl(:file "sbcl") - #+allegro(:file "acl") - #+cmu(:file "cmucl") - #+clisp(:file "clisp") - #+openmcl(:file "openmcl") - #+lispworks(:file "lispworks") - (:file "cl-smtp" :depends-on #+sbcl("sbcl") - #+allegro("acl") - #+cmu("cmucl") - #+clisp("clisp") - #+openmcl("openmcl") - #+lispworks("lispworks")) - (:file "attachments" :depends-on #+sbcl("sbcl") - #+allegro("acl") - #+cmu("cmucl") - #+clisp("clisp") - #+openmcl("openmcl") - #+lispworks("lispworks")))) + :version "20070904.1" + :depends-on (:usocket #-allegro :cl-base64) + :components ((:file "cl-smtp" :depends-on ("attachments")) + (:file "attachments"))) --- /project/cl-smtp/cvsroot/cl-smtp/cl-smtp.lisp 2006/04/04 13:04:40 1.5 +++ /project/cl-smtp/cvsroot/cl-smtp/cl-smtp.lisp 2007/09/04 18:54:06 1.6 @@ -18,15 +18,10 @@ (in-package :cl-smtp) -(defparameter *debug* nil) (defparameter *x-mailer* (format nil "(~A ~A)" (lisp-implementation-type) (lisp-implementation-version))) -(defmacro print-debug (str) - `(when *debug* - (print ,str))) - (defun check-arg (arg name) (cond ((or (stringp arg) @@ -83,7 +78,7 @@ (defun send-smtp (host from to subject message &key (port 25) cc bcc reply-to extra-headers display-name authentication attachments buffer-size) - (let ((sock (socket-stream (make-smtp-socket host port))) + (let ((sock (usocket:socket-stream (usocket:socket-connect host port))) (boundary (make-random-boundary))) (unwind-protect (progn @@ -153,7 +148,7 @@ (error "wrong response from smtp server: ~A" msgstr))) (cond (authentication - (write-to-smtp sock (format nil "EHLO ~A" (get-host-name))) + (write-to-smtp sock (format nil "EHLO ~A" (usocket::get-host-name))) (multiple-value-bind (code msgstr) (read-from-smtp sock) (when (/= code 250) @@ -189,7 +184,7 @@ (error "authentication ~A is not supported in cl-smtp" (car authentication))))) (t - (write-to-smtp sock (format nil "HELO ~A" (get-host-name))) + (write-to-smtp sock (format nil "HELO ~A" (usocket::get-host-name))) (multiple-value-bind (code msgstr) (read-from-smtp sock) (when (/= code 250) @@ -201,8 +196,7 @@ (write-to-smtp sock (format nil "RCPT TO:<~A>" to)) (multiple-value-bind (code msgstr) (read-from-smtp sock) - (when (/= code 250) - + (when (/= code 250) (error "in RCPT TO command: ~A" msgstr))))) From jidzikowski at common-lisp.net Tue Sep 4 18:56:58 2007 From: jidzikowski at common-lisp.net (jidzikowski) Date: Tue, 4 Sep 2007 14:56:58 -0400 (EDT) Subject: [cl-smtp-cvs] CVS cl-smtp Message-ID: <20070904185658.38C532B12B@common-lisp.net> Update of /project/cl-smtp/cvsroot/cl-smtp In directory clnet:/tmp/cvs-serv32123 Modified Files: attachments.lisp cl-smtp.asd cl-smtp.lisp Log Message: added 2006/2007 to copyright part --- /project/cl-smtp/cvsroot/cl-smtp/attachments.lisp 2006/04/04 13:04:40 1.1 +++ /project/cl-smtp/cvsroot/cl-smtp/attachments.lisp 2007/09/04 18:56:58 1.2 @@ -2,7 +2,7 @@ ;;; This file is part of CL-SMTP, the Lisp SMTP Client -;;; Copyright (C) 2004/2005 Jan Idzikowski +;;; Copyright (C) 2004/2005/2006/2007 Jan Idzikowski ;;; This library is free software; you can redistribute it and/or ;;; modify it under the terms of the Lisp Lesser General Public License --- /project/cl-smtp/cvsroot/cl-smtp/cl-smtp.asd 2007/09/04 18:54:06 1.7 +++ /project/cl-smtp/cvsroot/cl-smtp/cl-smtp.asd 2007/09/04 18:56:58 1.8 @@ -2,7 +2,7 @@ ;;; This file is part of CL-SMTP, the Lisp SMTP Client -;;; Copyright (C) 2004/2005 Jan Idzikowski +;;; Copyright (C) 2004/2005/2006/2007 Jan Idzikowski ;;; This library is free software; you can redistribute it and/or ;;; modify it under the terms of the Lisp Lesser General Public License --- /project/cl-smtp/cvsroot/cl-smtp/cl-smtp.lisp 2007/09/04 18:54:06 1.6 +++ /project/cl-smtp/cvsroot/cl-smtp/cl-smtp.lisp 2007/09/04 18:56:58 1.7 @@ -2,7 +2,7 @@ ;;; This file is part of CL-SMTP, the Lisp SMTP Client -;;; Copyright (C) 2004/2005 Jan Idzikowski +;;; Copyright (C) 2004/2005/2006/2007 Jan Idzikowski ;;; This library is free software; you can redistribute it and/or ;;; modify it under the terms of the Lisp Lesser General Public License From jidzikowski at common-lisp.net Tue Sep 4 19:59:50 2007 From: jidzikowski at common-lisp.net (jidzikowski) Date: Tue, 4 Sep 2007 15:59:50 -0400 (EDT) Subject: [cl-smtp-cvs] CVS cl-smtp Message-ID: <20070904195950.8D7AC65115@common-lisp.net> Update of /project/cl-smtp/cvsroot/cl-smtp In directory clnet:/tmp/cvs-serv11395 Modified Files: CHANGELOG Log Message: change datestr --- /project/cl-smtp/cvsroot/cl-smtp/CHANGELOG 2007/09/04 18:54:06 1.6 +++ /project/cl-smtp/cvsroot/cl-smtp/CHANGELOG 2007/09/04 19:59:50 1.7 @@ -1,5 +1,5 @@ -Version 20070628.1 -2007-06-28 +Version 20070904.1 +2007-09-04 Remove implementation dependent sockets code by adding usocket dependency. Change cl-smtp.asd cl-smtp.lisp README INSTALL (remove acl.lisp clisp.lisp cmucl.lisp sbcl.lisp lispworks.lisp openmcl.lisp) From jidzikowski at common-lisp.net Wed Sep 5 09:35:51 2007 From: jidzikowski at common-lisp.net (jidzikowski) Date: Wed, 5 Sep 2007 05:35:51 -0400 (EDT) Subject: [cl-smtp-cvs] CVS cl-smtp Message-ID: <20070905093551.39F51A182@common-lisp.net> Update of /project/cl-smtp/cvsroot/cl-smtp In directory clnet:/tmp/cvs-serv30740 Modified Files: attachments.lisp Log Message: fixed acl error in base64-encode-file, use excl:usb8-array-to-base64-string for acl --- /project/cl-smtp/cvsroot/cl-smtp/attachments.lisp 2007/09/04 18:56:58 1.2 +++ /project/cl-smtp/cvsroot/cl-smtp/attachments.lisp 2007/09/05 09:35:51 1.3 @@ -2,6 +2,7 @@ ;;; This file is part of CL-SMTP, the Lisp SMTP Client + ;;; Copyright (C) 2004/2005/2006/2007 Jan Idzikowski ;;; This library is free software; you can redistribute it and/or @@ -80,6 +81,7 @@ &key (buffer-size 256) ;; in KB (wrap-at-column 76)) + (declare (ignorable wrap-at-column)) (let* ((max-buffer-size (* buffer-size 1024)) (byte-count 0) (buffer (make-array max-buffer-size @@ -98,15 +100,22 @@ (return i) (setf (aref buffer i) bchar))))) (print-debug (format nil "~%** Byte Count ~a~%" byte-count)) - ;; encode the buffer and write out to stream - (cl-base64:usb8-array-to-base64-stream - (if (< byte-count max-buffer-size) - (trimmed-buffer byte-count buffer) - buffer) - sock :columns wrap-at-column) - (force-output sock) - ;;-- when finished reading exit do loop - (when (< byte-count max-buffer-size) + ;; encode the buffer and write out to stream + #+allegro + (write-string (excl:usb8-array-to-base64-string + (if (< byte-count max-buffer-size) + (trimmed-buffer byte-count buffer) + buffer) + wrap-at-column) sock) + #-allegro + (s-base64:encode-base64-bytes + (if (< byte-count max-buffer-size) + (trimmed-buffer byte-count buffer) + buffer) + sock t) + (force-output sock) + ;;-- when finished reading exit do loop + (when (< byte-count max-buffer-size) (return))))))) (defun trimmed-buffer (byte-count buffer)