]> git.eshelyaron.com Git - emacs.git/commitdiff
smtpmail would say it's done before it is
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Mon, 25 Apr 2016 22:59:50 +0000 (00:59 +0200)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Mon, 25 Apr 2016 22:59:50 +0000 (00:59 +0200)
* lisp/mail/smtpmail.el (smtpmail-via-smtp): Move the sending
of the data end marker from here... (bug#23020).
(smtpmail-send-data): ... to here, so that we don't get a
"Sending done" before we've sent the final "." (which can make
the SMPT server reject the email.

lisp/mail/smtpmail.el

index 8e0bb3ae6baecbe864bad2e5d25b5876ed0ef32b..f21b847b49b9f6389ad9743c227b212a62eb0009 100644 (file)
@@ -858,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
@@ -957,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
@@ -970,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)