[cl-smtp-cvs] CVS cl-smtp
jidzikowski
jidzikowski at common-lisp.net
Wed Sep 8 14:49:10 UTC 2010
Update of /project/cl-smtp/cvsroot/cl-smtp
In directory cl-net:/tmp/cvs-serv4206
Modified Files:
CHANGELOG README cl-smtp.asd cl-smtp.lisp
Log Message:
Add keyword envelope-sender to send-email, if envelope-sender not set
then envelope-sender = from argument.
Change x-mailer header setting.
----------------------------------------------------------------------
--- /project/cl-smtp/cvsroot/cl-smtp/CHANGELOG 2010/06/21 09:06:26 1.18
+++ /project/cl-smtp/cvsroot/cl-smtp/CHANGELOG 2010/09/08 14:49:10 1.19
@@ -1,3 +1,10 @@
+Version 20100908.1
+2010.09.08
+Add keyword envelope-sender to send-email, if envelope-sender not set then
+envelope-sender = from argument.
+Change x-mailer header setting.
+Change cl-smtp.lisp, cl-smtp.asd, CHANGELOG, README
+
Version 20100621.1
2010.06.21
Rewrite base64-encode-file in attachments.lisp, fixed wrap at column
--- /project/cl-smtp/cvsroot/cl-smtp/README 2010/06/21 09:06:26 1.11
+++ /project/cl-smtp/cvsroot/cl-smtp/README 2010/09/08 14:49:10 1.12
@@ -49,6 +49,8 @@
- ssl (or t :starttls :tls) : if t or :STARTTLS: use the STARTTLS functionality
if :TLS: use TLS directly
- external-format : symbol, default :utf-8
+ - envelope-sender : email adress,
+ if not set then envelope-sender = from
------------------------------------------------
--- /project/cl-smtp/cvsroot/cl-smtp/cl-smtp.asd 2010/06/21 09:06:27 1.18
+++ /project/cl-smtp/cvsroot/cl-smtp/cl-smtp.asd 2010/09/08 14:49:10 1.19
@@ -17,7 +17,7 @@
;;; Description: cl-smtp ASDF system definition file
(asdf:defsystem :cl-smtp
- :version "20100621.1"
+ :version "20100908.1"
:perform (load-op :after (op webpage)
(pushnew :cl-smtp cl:*features*))
:depends-on (:usocket
--- /project/cl-smtp/cvsroot/cl-smtp/cl-smtp.lisp 2010/08/23 15:18:34 1.18
+++ /project/cl-smtp/cvsroot/cl-smtp/cl-smtp.lisp 2010/09/08 14:49:10 1.19
@@ -18,7 +18,7 @@
(in-package :cl-smtp)
-(defparameter *x-mailer* (format nil "cl-smtp (~A ~A)"
+(defparameter *x-mailer* (format nil "(~A ~A)"
(lisp-implementation-type)
(lisp-implementation-version)))
@@ -143,8 +143,7 @@
:response-message msgstr))))
lines))
-(defun do-with-smtp-mail (host from to thunk &key port authentication ssl
- local-hostname (external-format :utf-8))
+(defun do-with-smtp-mail (host envelope-sender to thunk &key port authentication ssl local-hostname (external-format :utf-8))
(usocket:with-client-socket (socket stream host port
:element-type '(unsigned-byte 8))
(setf stream (flexi-streams:make-flexi-stream
@@ -156,11 +155,11 @@
:authentication authentication
:ssl ssl
:local-hostname local-hostname)))
- (initiate-smtp-mail stream from to)
+ (initiate-smtp-mail stream envelope-sender to)
(funcall thunk stream)
(finish-smtp-mail stream))))
-(defmacro with-smtp-mail ((stream-var host from to &key ssl (port (if (eq :tls ssl) 465 25)) authentication local-hostname (external-format :utf-8))
+(defmacro with-smtp-mail ((stream-var host envelope-sender to &key ssl (port (if (eq :tls ssl) 465 25)) authentication local-hostname (external-format :utf-8))
&body body)
"Encapsulate a SMTP MAIl conversation. A connection to the SMTP
server on HOST and PORT is established and a MAIL command is
@@ -168,7 +167,7 @@
recipients. BODY is evaluated with STREAM-VAR being the stream
connected to the remote SMTP server. BODY is expected to write the
RFC2821 message (headers and body) to STREAM-VAR."
- `(do-with-smtp-mail ,host ,from ,to
+ `(do-with-smtp-mail ,host ,envelope-sender ,to
(lambda (,stream-var) , at body)
:port ,port
:authentication ,authentication
@@ -179,7 +178,7 @@
(defun send-email (host from to subject message
&key ssl (port (if (eq :tls ssl) 465 25)) cc bcc reply-to extra-headers
html-message display-name authentication
- attachments (buffer-size 256) (external-format :utf-8))
+ attachments (buffer-size 256) envelope-sender (external-format :utf-8))
(send-smtp host from (check-arg to "to") subject (mask-dot message)
:port port :cc (check-arg cc "cc") :bcc (check-arg bcc "bcc")
:reply-to reply-to
@@ -191,6 +190,7 @@
:buffer-size (if (numberp buffer-size)
buffer-size
256)
+ :envelope-sender (or envelope-sender from)
:external-format external-format
:ssl ssl))
@@ -199,8 +199,9 @@
reply-to extra-headers html-message display-name
authentication attachments buffer-size
(local-hostname (usocket::get-host-name))
- (external-format :utf-8))
- (with-smtp-mail (stream host from (append to cc bcc)
+ (envelope-sender from)
+ (external-format :utf-8))
+ (with-smtp-mail (stream host envelope-sender (append to cc bcc)
:port port
:authentication authentication
:ssl ssl
@@ -380,7 +381,7 @@
(smtp-authenticate stream authentication features)))
stream)
-(defun initiate-smtp-mail (stream from to)
+(defun initiate-smtp-mail (stream envelope-sender to)
"Initiate an SMTP MAIL command, sending a MAIL FROM command for the
email address in FROM and RCPT commands for all receipients in TO,
which is expected to be a list.
@@ -389,7 +390,7 @@
is signalled. This condition may be handled by the caller in order
to send the email anyway."
(smtp-command stream
- (format nil "MAIL FROM:<~A>" (substitute-return-newline from))
+ (format nil "MAIL FROM:<~A>" (substitute-return-newline envelope-sender))
250)
(dolist (address to)
(restart-case
@@ -406,6 +407,7 @@
"Finish sending an email to the SMTP server connected to on STREAM.
The server is expected to be inside of the DATA SMTP command. The
connection is then terminated by sending a QUIT command."
+ ;;(fresh-line stream)
(write-to-smtp stream "")
(smtp-command stream "." 250)
(smtp-command stream "QUIT" 221))
@@ -430,7 +432,7 @@
(write-to-smtp stream (format nil "Subject: ~A"
(rfc2045-q-encode-string
subject :external-format external-format)))
- (write-to-smtp stream (format nil "X-Mailer: ~A"
+ (write-to-smtp stream (format nil "X-Mailer: cl-smtp~A"
(rfc2045-q-encode-string
*x-mailer* :external-format external-format)))
(when reply-to
More information about the Cl-smtp-cvs
mailing list