]> code.delx.au - gnu-emacs-elpa/commitdiff
smtpmail-async: Report status to user when done
authorJohn Wiegley <johnw@newartisans.com>
Wed, 20 Jun 2012 23:59:11 +0000 (18:59 -0500)
committerJohn Wiegley <johnw@newartisans.com>
Wed, 20 Jun 2012 23:59:11 +0000 (18:59 -0500)
smtpmail-async.el

index 4750ce6c561f2c7805a42937ed7ae63b1504c57f..2844071ecb3ea16c074a8bb33a2b713cac0f6266 100644 (file)
 (require 'smtpmail)
 
 (defun async-smtpmail-send-it ()
-  (async-start
-   `(lambda ()
-      (require 'smtpmail)
-      (with-temp-buffer
-        (insert ,(buffer-substring-no-properties (point-min) (point-max)))
-        ;; Pass in the variable environment for smtpmail
-        ,(async-inject-variables "\\`\\(smtpmail\\|\\(user-\\)?mail\\)-")
-        (smtpmail-send-it)))
-   'ignore))
+  (let ((to (message-field-value "To")))
+    (message "Delivering message to %s..." to)
+    (async-start
+     `(lambda ()
+        (require 'smtpmail)
+        (with-temp-buffer
+          (insert ,(buffer-substring-no-properties (point-min) (point-max)))
+          ;; Pass in the variable environment for smtpmail
+          ,(async-inject-variables "\\`\\(smtpmail\\|\\(user-\\)?mail\\)-")
+          (smtpmail-send-it)))
+     `(lambda (&optional ignore)
+        (message "Delivering message to %s...done" ,to)))))
 
 (provide 'smtpmail-async)