]> code.delx.au - gnu-emacs/blobdiff - lisp/mail/smtpmail.el
; Merge from origin/emacs-25
[gnu-emacs] / lisp / mail / smtpmail.el
index 3440741f573b15635a9e6e8a17d196b5b7bf1120..f21b847b49b9f6389ad9743c227b212a62eb0009 100644 (file)
@@ -1,6 +1,6 @@
 ;;; smtpmail.el --- simple SMTP protocol (RFC 821) for sending mail
 
-;; Copyright (C) 1995-1996, 2001-2014 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1996, 2001-2016 Free Software Foundation, Inc.
 
 ;; Author: Tomoji Kagatani <kagatani@rbc.ncl.omron.co.jp>
 ;; Maintainer: Simon Josefsson <simon@josefsson.org>
@@ -687,6 +687,7 @@ Returns an error if the server cannot be contacted."
                   "smtpmail" process-buffer host port
                   :type smtpmail-stream-type
                   :return-list t
+                  :warn-unless-encrypted ask-for-password
                   :capability-command (format "EHLO %s\r\n" (smtpmail-fqdn))
                   :end-of-command "^[0-9]+ .*\r\n"
                   :success "^2.*\n"
@@ -857,8 +858,6 @@ Returns an error if the server cannot be contacted."
            ;; Send the contents.
            (smtpmail-command-or-throw process "DATA")
            (smtpmail-send-data process smtpmail-text-buffer)
-           ;; DATA end "."
-           (smtpmail-command-or-throw process ".")
            ;; Return success.
            nil))
       (when (and process
@@ -956,10 +955,11 @@ Returns an error if the server cannot be contacted."
   (process-send-string process "\r\n"))
 
 (defun smtpmail-send-data (process buffer)
-  (let ((data-continue t) sending-data
+  (let ((data-continue t)
         (pr (with-current-buffer buffer
               (make-progress-reporter "Sending email "
-                                      (point-min) (point-max)))))
+                                      (point-min) (point-max))))
+        sending-data)
     (with-current-buffer buffer
       (goto-char (point-min)))
     (while data-continue
@@ -969,6 +969,8 @@ Returns an error if the server cannot be contacted."
        (end-of-line 2)
         (setq data-continue (not (eobp))))
       (smtpmail-send-data-1 process sending-data))
+    ;; DATA end "."
+    (smtpmail-command-or-throw process ".")
     (progress-reporter-done pr)))
 
 (defun smtpmail-deduce-address-list (smtpmail-text-buffer header-start header-end)