This commit was generated by cvs2svn to compensate for changes in r6137,
[elisp/gnus.git-] / lisp / smtp.el
index 331bd7e..1954200 100644 (file)
@@ -1,4 +1,4 @@
-;;; smtp.el --- basic functions of SMTP protocol (RFC 821)
+;;; smtp.el --- basic functions to send mail with SMTP server
 
 ;; Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc.
 
@@ -57,11 +57,6 @@ don't define this value."
   :type 'boolean
   :group 'smtp)
 
-(defcustom smtp-coding-system 'binary
-  "*Coding-system for SMTP output."
-  :type 'coding-system
-  :group 'smtp)
-
 
 (defun smtp-fqdn ()
   (if smtp-local-domain
@@ -75,9 +70,7 @@ don't define this value."
        response-code
        greeting
        process-buffer
-       (supported-extensions '())
-       (coding-system-for-read smtp-coding-system)
-       (coding-system-for-write smtp-coding-system))
+       (supported-extensions '()))
     (unwind-protect
        (catch 'done
          ;; get or create the trace buffer
@@ -91,7 +84,8 @@ don't define this value."
            (erase-buffer))
 
          ;; open the connection to the server
-         (setq process (open-network-stream "SMTP" process-buffer host port))
+         (setq process (open-network-stream-as-binary
+                        "SMTP" process-buffer host port))
          (and (null process) (throw 'done nil))
 
          ;; set the send-filter
@@ -361,7 +355,7 @@ don't define this value."
        (setq this-line-end (point))
        (setq sending-data nil)
        (setq sending-data (buffer-substring this-line this-line-end))
-       (if (/= (forward-line 1) 0)
+       (if (or (/= (forward-line 1) 0) (eobp))
            (setq data-continue nil)))
 
       (smtp-send-data-1 process sending-data)
@@ -376,19 +370,21 @@ don't define this value."
        (simple-address-list "")
        this-line
        this-line-end
-       addr-regexp)
-    
+       addr-regexp
+       (smtp-address-buffer (generate-new-buffer " *smtp-mail*")))
     (unwind-protect
        (save-excursion
          ;;
-         (set-buffer smtp-address-buffer) (erase-buffer)
+         (set-buffer smtp-address-buffer)
+         (erase-buffer)
          (insert-buffer-substring smtp-text-buffer
                                   header-start header-end)
          (goto-char (point-min))
          ;; RESENT-* fields should stop processing of regular fields.
          (save-excursion
            (if (re-search-forward "^RESENT-TO:" header-end t)
-               (setq addr-regexp "^\\(RESENT-TO:\\|RESENT-CC:\\|RESENT-BCC:\\)")
+               (setq addr-regexp
+                     "^\\(RESENT-TO:\\|RESENT-CC:\\|RESENT-BCC:\\)")
              (setq addr-regexp  "^\\(TO:\\|CC:\\|BCC:\\)")))
 
          (while (re-search-forward addr-regexp header-end t)
@@ -401,15 +397,19 @@ don't define this value."
            (setq this-line-end (point-marker))
            (setq simple-address-list
                  (concat simple-address-list " "
-                         (mail-strip-quoted-names (buffer-substring this-line this-line-end))))
+                         (mail-strip-quoted-names
+                          (buffer-substring this-line this-line-end))))
            )
          (erase-buffer)
          (insert-string " ")
          (insert-string simple-address-list)
          (insert-string "\n")
-         (subst-char-in-region (point-min) (point-max) 10 ?  t);; newline --> blank
-         (subst-char-in-region (point-min) (point-max) ?, ?  t);; comma   --> blank
-         (subst-char-in-region (point-min) (point-max)  9 ?  t);; tab     --> blank
+         ;; newline --> blank
+         (subst-char-in-region (point-min) (point-max) 10 ?  t)
+         ;; comma   --> blank
+         (subst-char-in-region (point-min) (point-max) ?, ?  t)
+         ;; tab     --> blank
+         (subst-char-in-region (point-min) (point-max)  9 ?  t)
 
          (goto-char (point-min))
          ;; tidyness in case hook is not robust when it looks at this
@@ -419,15 +419,14 @@ don't define this value."
          (let (recipient-address-list)
            (while (re-search-forward " \\([^ ]+\\) " (point-max) t)
              (backward-char 1)
-             (setq recipient-address-list (cons (buffer-substring (match-beginning 1) (match-end 1))
-                                                recipient-address-list))
+             (setq recipient-address-list
+                   (cons (buffer-substring (match-beginning 1) (match-end 1))
+                         recipient-address-list))
              )
-           (setq smtp-recipient-address-list recipient-address-list))
-
+           recipient-address-list)
          )
-      )
-    )
-  )
+      (kill-buffer smtp-address-buffer))
+    ))
 
 (defun smtp-do-bcc (header-end)
   "Delete BCC: and their continuation lines from the header area.