* wl-vars.el (wl-message-id-use-wl-from): New variable.
[elisp/wanderlust.git] / wl / wl-util.el
index aae027b..54d53a3 100644 (file)
@@ -638,16 +638,24 @@ that `read' can handle, whenever this is possible."
      ;; Append the name of the message interface, because while the
      ;; generated ID is unique to this newsreader, other newsreaders
      ;; might otherwise generate the same ID via another algorithm.
-     ".wl")))
+     wl-unique-id-suffix)))
 
 (defun wl-draft-make-message-id-string ()
   "Return Message-ID field value."
-  (concat "<" (wl-unique-id) "@"
-         (or wl-message-id-domain
-             (if wl-local-domain
-                 (concat (system-name) "." wl-local-domain)
-               (system-name)))
-         ">"))
+  (concat "<" (wl-unique-id)
+         (let (from user domain)
+           (if (and wl-message-id-use-wl-from
+                    (progn
+                      (setq from (wl-address-header-extract-address wl-from))
+                      (and (string-match "^\\(.*\\)@\\(.*\\)$" from)
+                           (setq user   (match-string 1 from))
+                           (setq domain (match-string 2 from)))))
+               (format "%%%s@%s>" user domain)
+             (format "@%s>"
+                     (or wl-message-id-domain
+                         (if wl-local-domain
+                             (concat (system-name) "." wl-local-domain)
+                           (system-name))))))))
 
 ;;; Profile loading.
 (defvar wl-load-profile-function 'wl-local-load-profile)