+2004-03-12  Reiner Steib  <Reiner.Steib@gmx.de>
+
+       * imap.el (imap-store-password): New variable.
+       (imap-interactive-login): Use it.
+       Suggested by Mark Plaksin <happy@mcplaksin.org>.
+
 2004-03-12  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * gnus-art.el (gnus-article-read-summary-keys): Restore new
 
   :type 'number
   :group 'imap)
 
+(defcustom imap-store-password nil
+  "If non-nil, store session password without promting."
+  :group 'imap
+  :type 'boolean)
+
 ;; Various variables.
 
 (defvar imap-fetch-data-hook nil
              (progn
                (setq ret t
                      imap-username user)
-               (if (and (not imap-password)
-                        (y-or-n-p "Store password for this session? "))
-                   (setq imap-password passwd)))
+               (when (and (not imap-password)
+                          (or imap-store-password
+                              (y-or-n-p "Store password for this session? ")))
+                 (setq imap-password passwd)))
            (message "Login failed...")
            (setq passwd nil)
            (setq imap-password nil)