2001-07-30 AMAKAWA Shuhei <sa264@cam.ac.uk>
[elisp/flim.git] / smtp.el
diff --git a/smtp.el b/smtp.el
index 0d3fef5..a3f97c6 100644 (file)
--- a/smtp.el
+++ b/smtp.el
@@ -1,6 +1,6 @@
 ;;; smtp.el --- basic functions to send mail with SMTP server
 
-;; Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1996, 1998, 1999, 2000 Free Software Foundation, Inc.
 
 ;; Author: Tomoji Kagatani <kagatani@rbc.ncl.omron.co.jp>
 ;;     Simon Leinen <simon@switch.ch> (ESMTP support)
 
 ;;; Code:
 
-(require 'pces)
 (require 'custom)
 (require 'mail-utils)                  ; mail-strip-quoted-names
 (require 'sasl)
 (require 'luna)
+(require 'mel) ; binary-funcall
 
 (defgroup smtp nil
   "SMTP protocol for sending mail."
@@ -112,7 +112,8 @@ don't define this value."
   :group 'smtp-extensions)
 
 (defvar sasl-mechanisms)
-  
+
+;;;###autoload
 (defvar smtp-open-connection-function #'open-network-stream)
 
 (defvar smtp-read-point nil)
@@ -234,12 +235,10 @@ to connect to.  SERVICE is name of the service desired."
 Return a newly allocated connection-object.
 BUFFER is the buffer to associate with the connection.  SERVER is name
 of the host to connect to.  SERVICE is name of the service desired."
-  (let* ((coding-system-for-read  'binary)
-        (coding-system-for-write 'binary)
-        (process
-         (funcall smtp-open-connection-function
-                  "SMTP" buffer  server service))
-        connection)
+  (let ((process
+        (binary-funcall smtp-open-connection-function
+                        "SMTP" buffer server service))
+       connection)
     (when process
       (setq connection (smtp-make-connection process server service))
       (set-process-filter process 'smtp-process-filter)
@@ -250,6 +249,7 @@ of the host to connect to.  SERVICE is name of the service desired."
 
 ;;;###autoload
 (defun smtp-via-smtp (sender recipients buffer)
+  "Like `smtp-send-buffer', but sucks in any errors."
   (condition-case nil
       (progn
        (smtp-send-buffer sender recipients buffer)
@@ -260,6 +260,10 @@ of the host to connect to.  SERVICE is name of the service desired."
 
 ;;;###autoload
 (defun smtp-send-buffer (sender recipients buffer)
+  "Send a message.
+SENDER is an envelope sender address.
+RECIPIENTS is a list of envelope recipient addresses.
+BUFFER may be a buffer or a buffer name which contains mail message."
   (let ((server
         (if (functionp smtp-server)
             (funcall smtp-server sender recipients)
@@ -291,7 +295,9 @@ of the host to connect to.  SERVICE is name of the service desired."
          (smtp-response-error
           (smtp-primitive-helo package)))
        (if smtp-use-starttls
-           (smtp-primitive-starttls package))
+           (progn
+           (smtp-primitive-starttls package)
+           (smtp-primitive-ehlo package)))
        (if smtp-use-sasl
            (smtp-primitive-auth package))
        (smtp-primitive-mailfrom package)