From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Sergey Poznyakoff Newsgroups: gmane.emacs.devel Subject: Re: Updating movemail in Emacs Date: Mon, 22 Nov 2004 15:57:05 +0200 Organization: Farlep-Internet Message-ID: <200411221357.iAMDv5027454@Mirddin.farlep.net> References: <200411011451.JAA28950@smtp.ott.qnx.com> <200411011509.iA1F91017792@Mirddin.farlep.net> <200411031853.iA3IrL011498@Mirddin.farlep.net> <200411181708.iAIH8e028114@Mirddin.farlep.net> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="1804289383-1101131704=:27437" X-Trace: sea.gmane.org 1101131892 17239 80.91.229.6 (22 Nov 2004 13:58:12 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 22 Nov 2004 13:58:12 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 22 14:57:44 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CWEhF-0006Y5-00 for ; Mon, 22 Nov 2004 14:57:38 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CWEqG-0002AQ-PT for ged-emacs-devel@m.gmane.org; Mon, 22 Nov 2004 09:06:57 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CWEq3-0002AA-Cf for emacs-devel@gnu.org; Mon, 22 Nov 2004 09:06:43 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CWEq2-00029x-6S for emacs-devel@gnu.org; Mon, 22 Nov 2004 09:06:43 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CWEq2-00029o-2I for emacs-devel@gnu.org; Mon, 22 Nov 2004 09:06:42 -0500 Original-Received: from [213.130.0.1] (helo=Mirddin.farlep.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CWEgo-0005R0-RV for emacs-devel@gnu.org; Mon, 22 Nov 2004 08:57:12 -0500 Original-Received: from Mirddin.farlep.net (localhost [127.0.0.1]) by Mirddin.farlep.net with ESMTP id iAMDv5027454 for ; Mon, 22 Nov 2004 15:57:05 +0200 X-Mailutils-Message-Id: iAMDv5027454 Original-To: emacs-devel@gnu.org In-reply-to: Your message of Sat, 20 Nov 2004 20:10:25 -0500 X-Mailer: MH-E 7.4.2+cvs; GNU Mailutils 0.5; GNU Emacs 21.3.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:30242 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:30242 --1804289383-1101131704=:27437 Content-ID: <20041122155504.27437.1@Mirddin.farlep.net> Content-Type: text/plain Attached is the updated patch. The most important difference compared with the previous one is that this version allows to specify mailbox URLs (pop://user:pass@server) even when emacs movemail is used. One notice: rmail-insert-inbox-text contains branches that move inbox contents directly using (copy-file) or (rename-file). Currently these are not used, since the controlling variable `movemail' is set unconditionally to `t'. Are there any plans to use these branches? Or can I just remove them? ChangeLog entry: 2004-11-22 Sergey Poznyakoff * mail/rmail.el: Updated to work with movemail from GNU Mailutils (rmail-pop-password,rmail-pop-password-required): Moved to rmail-obsolete group. (rmail-set-pop-password): Renamed to rmail-set-remote-password. All callers updated. (rmail-get-pop-password): Renamed to rmail-get-remote-password. Take an argument specifying whether it is POP or IMAP mailbox we are using. All callers updated. (rmail-pop-password-error): Renamed to rmail-remote-password-error. Added mailutils-specific error message. (rmail-movemail-search-path) (rmail-movemail-variant-in-use): New variables. (rmail-remote-password,rmail-remote-password-required): New customization variables. (rmail-probe,rmail-autodetect,rmail-movemail-variant-p): New functions (rmail-parse-url): New function. (rmail-get-new-mail,rmail-insert-inbox-text): Updated for use with GNU mailutils movemail. Accept mailbox URLs no matter what flavor of movemail is being used. * etc/NEWS: Document changes to rmail.el * man/rmail.texi: Likewise Regards, Sergey --1804289383-1101131704=:27437 Content-transfer-encoding: quoted-printable Content-Description: Content-ID: <20041122155504.27437.1@Mirddin.farlep.net> Content-Type: text/x-patch; name="emacs-rmail.diff" Index: etc/NEWS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/emacs/emacs/etc/NEWS,v retrieving revision 1.1067 diff -p -u -r1.1067 NEWS --- etc/NEWS 15 Nov 2004 15:20:13 -0000 1.1067 +++ etc/NEWS 22 Nov 2004 13:40:29 -0000 @@ -95,6 +95,14 @@ See the files mac/README and mac/INSTALL ** Building with -DENABLE_CHECKING does not automatically build with union types any more. Add -DUSE_LISP_UNION_TYPE if you want union types. = +-- +** Support for `movemail' from GNU mailutils was added. This version of +`movemail' allows to read mail from a wide range of mailbox formats, +including remote POP3 and IMAP4 mailboxes with or without TLS +encryption. If GNU mailutils is installed on the system and its +version of `movemail' can be found in exec-path, it will be used +instead of the native one. + =0C * Changes in Emacs 21.4 = Index: lisp/mail/rmail.el =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/emacs/emacs/lisp/mail/rmail.el,v retrieving revision 1.393 diff -p -u -r1.393 rmail.el --- lisp/mail/rmail.el 12 Nov 2004 17:08:57 -0000 1.393 +++ lisp/mail/rmail.el 22 Nov 2004 13:40:30 -0000 @@ -91,6 +91,9 @@ :prefix "rmail-edit-" :group 'rmail) = +(defgroup rmail-obsolete nil + "Rmail obsolete customization variables." + :group 'rmail) = (defcustom rmail-movemail-program nil "If non-nil, name of program for fetching new mail." @@ -98,15 +101,46 @@ :type '(choice (const nil) string)) = (defcustom rmail-pop-password nil - "*Password to use when reading mail from a POP server, if required." + "*Password to use when reading mail from POP server. Please, use rmail-re= mote-password instead." :type '(choice (string :tag "Password") (const :tag "Not Required" nil)) - :group 'rmail-retrieve) + :group 'rmail-obsolete) = (defcustom rmail-pop-password-required nil - "*Non-nil if a password is required when reading mail using POP." + "*Non-nil if a password is required when reading mail from a POP server. = Please, use rmail-remote-password-required instead." :type 'boolean - :group 'rmail-retrieve) + :group 'rmail-obsolete) + +(defcustom rmail-remote-password nil + "*Password to use when reading mail from a remote server. This setting is= ignored for mailboxes whose URL already contains a password." + :type '(choice (string :tag "Password") + (const :tag "Not Required" nil)) + :set-after '(rmail-pop-password) + :set #'(lambda (symbol value) + (set-default symbol = + (if (and (not value) + (boundp 'rmail-po= p-password) + rmail-pop-password) + rmail-pop-password + value)) + (setq rmail-pop-password nil)) + :group 'rmail-retrieve + :version "21.3.50.1") + +(defcustom rmail-remote-password-required nil + "*Non-nil if a password is required when reading mail from a remote serve= r." + :type 'boolean + :set-after '(rmail-pop-password-required) + :set #'(lambda (symbol value) + (set-default symbol = + (if (and (not value) + (boundp 'rmail-pop-password-required) + rmail-pop-password-required) + rmail-pop-password-required + value)) + (setq rmail-pop-password-required nil)) + :group 'rmail-retrieve + :version "21.3.50.1") = (defcustom rmail-movemail-flags nil "*List of flags to pass to movemail. @@ -116,13 +150,14 @@ or `-k' to enable Kerberos authenticatio :group 'rmail-retrieve :version "20.3") = -(defvar rmail-pop-password-error "invalid usercode or password\\| -unknown user name or bad password" - "Regular expression matching incorrect-password POP server error messages= . +(defvar rmail-remote-password-error "invalid usercode or password\\| +unknown user name or bad password\\|Authentication failed\\|MU_ERR_AUTH_FAI= LURE" + "Regular expression matching incorrect-password POP or IMAP server error +messages. If you get an incorrect-password error that this expression does not match,= please report it with \\[report-emacs-bug].") = -(defvar rmail-encoded-pop-password nil) +(defvar rmail-encoded-remote-password nil) = (defcustom rmail-preserve-inbox nil "*Non-nil if incoming mail should be left in the user's inbox, @@ -130,6 +165,67 @@ rather than deleted, after it is retriev :type 'boolean :group 'rmail-retrieve) = +(defcustom rmail-movemail-search-path nil + "*List of directories to search for movemail (in addition to `exec-path= ')." + :group 'rmail-retrieve + :type '(repeat (directory))) + +(defun rmail-probe (prog) + "Determine what flavor of movemail PROG is by executing it with --version= +command line option and analyzing its output." + (with-temp-buffer + (let ((tbuf (current-buffer))) + (buffer-disable-undo tbuf) + (call-process prog nil tbuf nil "--version") + (if (not (buffer-modified-p tbuf)) + ;; Should not happen... + nil + (goto-char (point-min)) + (cond + ((looking-at ".*movemail: invalid option") + 'emacs) ;; Possibly... + ((looking-at "movemail (GNU Mailutils .*)") + 'mailutils) + (t + ;; FIXME: + 'emacs)))))) + +(defun rmail-autodetect () + "Determine and return the flavor of `movemail' program in use. If +rmail-movemail-program is set, use it. Otherwise, look for `movemail' +in the path constructed by appending rmail-movemail-search-path, +exec-path and exec-directory." + (if rmail-movemail-program + (rmail-probe rmail-movemail-program) + (catch 'scan + (dolist (dir (append rmail-movemail-search-path exec-path + (list exec-directory))) + (when (and dir (file-accessible-directory-p dir)) + (let ((progname (expand-file-name "movemail" dir))) + (when (and (not (file-directory-p progname)) + (file-executable-p progname)) + (let ((x (rmail-probe progname))) + (when x + (setq rmail-movemail-program progname) + (throw 'scan x)))))))))) + +(defvar rmail-movemail-variant-in-use nil + "The movemail variant currently in use. Known variants are: + + `emacs' Means any implementation, compatible with the native Emacs on= e. + This is the default; + `mailutils' Means GNU mailutils implementation, capable of handling full +mail URLs as the source mailbox;") + +;;;###autoload +(defun rmail-movemail-variant-p (&rest variants) + "Return t if the current movemail variant is any of VARIANTS. +Currently known variants are 'emacs and 'mailutils." + (when (not rmail-movemail-variant-in-use) + ;; Autodetect + (setq rmail-movemail-variant-in-use (rmail-autodetect))) + (not (null (member rmail-movemail-variant-in-use variants)))) + ;;;###autoload (defcustom rmail-dont-reply-to-names nil "\ *A regexp specifying addresses to prune from a reply message. @@ -1516,6 +1612,40 @@ It returns t if it got any new messages. ;; Don't leave the buffer screwed up if we get a disk-full error. (or found (rmail-show-message))))) = +(defun rmail-parse-url (file) + "Parse the supplied URL. Return (list MAILBOX-NAME REMOTE PASSWORD GOT-PA= SSWORD) +WHERE MAILBOX-NAME is the name of the mailbox suitable as argument to the +actual version of `movemail', REMOTE is non-nil if MAILBOX-NAME refers to +a remote mailbox, PASSWORD is the password if it should be +supplied as a separate argument to `movemail' or nil otherwise, GOT-PASSWOR= D +is non-nil if the user has supplied the password interactively. +" + (if (string-match "^\\([^:]+\\)://\\(\\([^:@]+\\)\\(:\\([^@]+\\)\\)?@\\)?= .*" file) + (let (got-password supplied-password = + (proto (match-string 1 file)) + (user (match-string 3 file)) + (pass (match-string 5 file)) + (host (substring file (or (match-end 2) + (+ 3 (match-end 1)))))) + (if (not pass) + (when rmail-remote-password-required + (setq got-password (not (rmail-have-password))) + (setq supplied-password (rmail-get-remote-password + (string-equal proto "imap"))))) + = + (if (rmail-movemail-variant-p 'emacs) + (if (string-equal proto "pop") + (list (concat "po:" user ":" host) + t + (or pass supplied-password) + got-password) + (error "Emacs movemail does not support %s protocol" proto)) + (list file + (or (string-equal proto "pop") (string-equal proto "imap")) + supplied-password + got-password))) + (list file nil nil nil))) + (defun rmail-insert-inbox-text (files renamep) ;; Detect a locked file now, so that we avoid moving mail ;; out of the real inbox file. (That could scare people.) @@ -1524,10 +1654,15 @@ It returns t if it got any new messages. (file-name-nondirectory buffer-file-name))) (let (file tofile delete-files movemail popmail got-password password) (while files - ;; Handle POP mailbox names specially; don't expand as filenames + ;; Handle remote mailbox names specially; don't expand as filenames ;; in case the userid contains a directory separator. (setq file (car files)) - (setq popmail (string-match "^po:" file)) + (let ((url-data (rmail-parse-url file))) + (setq file (nth 0 url-data)) + (setq popmail (nth 1 url-data)) + (setq password (nth 2 url-data)) + (setq got-password (nth 3 url-data))) + (if popmail (setq renamep t) (setq file (file-truename @@ -1535,7 +1670,12 @@ It returns t if it got any new messages. (setq tofile (expand-file-name ;; Generate name to move to from inbox name, ;; in case of multiple inboxes that need moving. - (concat ".newmail-" (file-name-nondirectory file)) + (concat ".newmail-" + (file-name-nondirectory = + (if (memq system-type '(windows-nt cygwin)) + ;; cannot have "po:" in file name + (substring file 3) + file))) ;; Use the directory of this rmail file ;; because it's a nuisance to use the homedir ;; if that is on a full disk and this rmail @@ -1560,18 +1700,7 @@ It returns t if it got any new messages. (setq file (expand-file-name (user-login-name) file))))) (cond (popmail - (if rmail-pop-password-required - (progn (setq got-password (not (rmail-have-password))) - (setq password (rmail-get-pop-password)))) - (if (memq system-type '(windows-nt cygwin)) - ;; cannot have "po:" in file name - (setq tofile - (expand-file-name - (concat ".newmail-pop-" - (file-name-nondirectory (substring file 3))) - (file-name-directory - (expand-file-name buffer-file-name))))) - (message "Getting mail from post office ...")) + (message "Getting mail from the remote server ...")) ((and (file-exists-p tofile) (/=3D 0 (nth 7 (file-attributes tofile)))) (message "Getting mail from %s..." tofile)) @@ -1603,50 +1732,59 @@ It returns t if it got any new messages. (write-region (point) (point) file) (file-error nil)))) (t - (let ((errors nil)) - (unwind-protect - (save-excursion - (setq errors (generate-new-buffer " *rmail loss*")) - (buffer-disable-undo errors) - (let ((args - (append - (list (or rmail-movemail-program - (expand-file-name "movemail" - exec-directory)) - nil errors nil) - (if rmail-preserve-inbox - (list "-p") - nil) - rmail-movemail-flags - (list file tofile) - (if password (list password) nil)))) - (apply 'call-process args)) - (if (not (buffer-modified-p errors)) - ;; No output =3D> movemail won - nil - (set-buffer errors) - (subst-char-in-region (point-min) (point-max) - ?\n ?\ ) - (goto-char (point-max)) - (skip-chars-backward " \t") - (delete-region (point) (point-max)) - (goto-char (point-min)) - (if (looking-at "movemail: ") - (delete-region (point-min) (match-end 0))) - (beep t) - (message "movemail: %s" - (buffer-substring (point-min) - (point-max))) - ;; If we just read the password, most likely it is - ;; wrong. Otherwise, see if there is a specific - ;; reason to think that the problem is a wrong passwd. - (if (or got-password - (re-search-forward rmail-pop-password-error - nil t)) - (rmail-set-pop-password nil)) - (sit-for 3) - nil)) - (if errors (kill-buffer errors)))))) + (with-temp-buffer + (let ((errors (current-buffer))) + (buffer-disable-undo errors) + (let ((args + (append + (list (or rmail-movemail-program + (expand-file-name "movemail" + exec-directory)) + nil errors nil) + (if rmail-preserve-inbox + (list "-p") + nil) + (if (rmail-movemail-variant-p 'mailutils) + (append (list "--emacs") rmail-movemail-flags) + rmail-movemail-flags) + (list file tofile) + (if password (list password) nil)))) + (apply 'call-process args)) + (if (not (buffer-modified-p errors)) + ;; No output =3D> movemail won + nil + (set-buffer errors) + (subst-char-in-region (point-min) (point-max) + ?\n ?\ ) + (goto-char (point-max)) + (skip-chars-backward " \t") + (delete-region (point) (point-max)) + (goto-char (point-min)) + (if (looking-at "movemail: ") + (delete-region (point-min) (match-end 0))) + (beep t) + ;; If we just read the password, most likely it is + ;; wrong. Otherwise, see if there is a specific + ;; reason to think that the problem is a wrong passwd. + (if (or got-password + (re-search-forward rmail-remote-password-error + nil t)) + (rmail-set-remote-password nil)) + + ;; If using Mailutils, remove initial error code + ;; abbreviation + (when (rmail-movemail-variant-p 'mailutils) + (goto-char (point-min)) + (when (looking-at "[A-Z][A-Z0-9_]*:") + (delete-region (point-min) (match-end 0)))) + = + (message "movemail: %s" + (buffer-substring (point-min) + (point-max))) + = + (sit-for 3) + nil))))) + = ;; At this point, TOFILE contains the name to read: ;; Either the alternate name (if we renamed) ;; or the actual inbox (if not renaming). @@ -3832,27 +3970,30 @@ TEXT and INDENT are not used." ; nor is it meant to be. = ;;;###autoload -(defun rmail-set-pop-password (password) - "Set PASSWORD to be used for retrieving mail from a POP server." +(defun rmail-set-remote-password (password) + "Set PASSWORD to be used for retrieving mail from a POP or IMAP server." (interactive "sPassword: ") (if password - (setq rmail-encoded-pop-password + (setq rmail-encoded-remote-password (rmail-encode-string password (emacs-pid))) - (setq rmail-pop-password nil) - (setq rmail-encoded-pop-password nil))) + (setq rmail-remote-password nil) + (setq rmail-encoded-remote-password nil))) = -(defun rmail-get-pop-password () - "Get the password for retrieving mail from a POP server. If none +(defun rmail-get-remote-password (imap) + "Get the password for retrieving mail from a POP or IMAP server. If none= has been set, then prompt the user for one." - (if (not rmail-encoded-pop-password) - (progn (if (not rmail-pop-password) - (setq rmail-pop-password (read-passwd "POP password: "))) - (rmail-set-pop-password rmail-pop-password) - (setq rmail-pop-password nil))) - (rmail-encode-string rmail-encoded-pop-password (emacs-pid))) + (when (not rmail-encoded-remote-password) + (if (not rmail-remote-password) + (setq rmail-remote-password + (read-passwd (if imap + "IMAP password: " + "POP password: ")))) + (rmail-set-remote-password rmail-remote-password) + (setq rmail-remote-password nil)) + (rmail-encode-string rmail-encoded-remote-password (emacs-pid))) = (defun rmail-have-password () - (or rmail-pop-password rmail-encoded-pop-password)) + (or rmail-remote-password rmail-encoded-remote-password)) = (defun rmail-encode-string (string mask) "Encode STRING with integer MASK, by taking the exclusive OR of the Index: man/rmail.texi =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/emacs/emacs/man/rmail.texi,v retrieving revision 1.20 diff -p -u -r1.20 rmail.texi --- man/rmail.texi 2 Nov 2003 07:01:13 -0000 1.20 +++ man/rmail.texi 22 Nov 2004 13:40:30 -0000 @@ -37,7 +37,10 @@ visiting a proper Rmail file. * Digest: Rmail Digest. Extracting the messages from a digest message.= * Out of Rmail:: Converting an Rmail file to mailbox format. * Rot13: Rmail Rot13. Reading messages encoded in the rot13 code. -* Movemail: Movemail. More details of fetching new mail. +* Movemail:: More details of fetching new mail. +* Remote Mailboxes:: Retrieving Mail from Remote Mailboxes. +* Other Mailbox Formats:: Retrieving Mail from Local Mailboxes in + Various Formats @end menu = @node Rmail Basics @@ -1152,9 +1155,116 @@ rot13-other-window}. This displays the = which applies the code when displaying the text. = @node Movemail -@section @code{movemail} and POP +@section @code{movemail} program @cindex @code{movemail} program = + When invoked for the first time, Rmail attempts to locate +@code{movemail} program and determine its version. There are +two versions of @code{movemail} program: the native one, shipped with +GNU Emacs (we will refer to it as @samp{emacs version}) and the one +coming from GNU mailutils (@xref{movemail,,,mailutils,GNU mailutils}, +we will refer to it as @samp{mailutils version}). Both versions are +compatible with each other in the sense that they support the same +command line syntax and the same basic subset of options. However, +@samp{mailutils} version offers a much reacher set of +possibilities. + +@samp{Emacs version} of @code{movemail} is able to retrieve mail from usual= +UNIX mailbox formats and from remote mailboxes using POP3 protocol. + +@samp{Mailutils version} is able to handle a wide set of mailbox +formats, such as plain UNIX mailboxes, @code{maildir} and @code{MH} +mailboxes, etc. It is able to retrieve remote mail using POP3 or IMAP4 +protocol. In the latter case, @code{mailutils movemail} can be +instructed to retrieve mail using TLS encrypted channel. + +@samp{Mailutils movemail} accepts mailbox argument in a @acronym{URL} +form. The detailed description of mailbox @acronym{URL}s can be found +in @ref{URL,,,mailutils,Mailbox URL Formats}. In short, an +@acronym{URL} is: + +@smallexample +@var{proto}://[@var{user}[:@var{password}]@@]@var{host-or-file-name} +@end smallexample + +@noindent +where square brackets denote optional elements. + +@table @var +@item proto +Specifies the @dfn{mailbox protocol}, or @dfn{format} to +use. The exact semantics of the rest of @acronym{URL} elements depends +on the actual value of @var{proto}. + +@item user +User name to access a remote mailbox. + +@item password +User password to access a remote mailbox. + +@item host-or-file-name +Hostname of the remote server for remote mailboxes or file name of a +local mailbox. +@end table + +@var{Proto} can be one of: + +@table @asis +@item mbox +Usual UNIX mailbox format. In this case neither @var{user} nor +@var{pass} are used. @var{Host-or-file-name} denotes the file name of +the mailbox file. E.g. @code{mbox://var/spool/mail/smith}. + +@item mh +A local mailbox in @acronym{MH} format. @var{User} and +@var{pass} are not used. @var{Host-or-file-name} denotes the name of +@acronym{MH} folder. E.g. @code{mh://Mail/inbox}. + +@item maildir +A local mailbox in @acronym{maildir} format. @var{User} and +@var{pass} are not used. @var{Host-or-file-name} denotes the name of +@code{maildir} mailbox. E.g. @code{maildir://mail/inbox}. + +@item file +Any local mailbox format. Its actual format is detected automatically +by @code{movemail}. + +@item pop +A remote mailbox to be accessed via POP3 protocol. @var{User} +specifies the remote user name to use. @var{Pass} may be used to +specify the user password. @var{Host-or-file-name} is the name or IP +address of the remote mail server to connect to. E.g.: +@code{pop://smith:guessme@@remote.server.net}. + = +@item imap +A remote mailbox to be accessed via IMAP4 protocol. @var{User} +specifies the remote user name to use. @var{Pass} may be used to +specify the user password. @var{Host-or-file-name} is the name or IP +address of the remote mail server to connect to. +E.g.: @code{imap://smith:guessme@@remote.server.net}. +@end table + +Alternatively, the mailbox may be specified as a file name of the +mailbox to use. This is equivalent to specifying @samp{file} protocol: + +@smallexample +/var/spool/mail/user @equiv{} file://var/spool/mail/user +@end smallexample + +@vindex rmail-movemail-program +@vindex rmail-movemail-search-path + To determine which version of @code{movemail} is being used, Rmail +examines the value of @code{rmail-movemail-program} variable. If it +is set, its value is used as a full name of @code{movemail} binary. +Otherwise, Rmail searches for @code{movemail} in path +constructed by appending @code{rmail-movemail-search-path}, +@code{exec-path} @code{exec-directory}. = + = +@pindex movemail + +@node Remote Mailboxes +@section Retrieving Mail from Remote Mailboxes + @vindex rmail-preserve-inbox When getting new mail, Rmail first copies the new mail from the inbox file to the Rmail file; then it saves the Rmail file; then it truncates @@ -1175,7 +1285,6 @@ file. If there is a crash at the wrong = exist, and Rmail will use it again the next time it gets new mail from that inbox. = -@pindex movemail If Rmail is unable to convert the data in @file{~/.newmail-@var{inboxname}} into Babyl format, it renames the file to @file{~/RMAILOSE.@var{n}} (@var{n} is an integer chosen to make the @@ -1186,30 +1295,68 @@ You should look at the file, find whatev the corrected file. = Some sites use a method called POP for accessing users' inbox data -instead of storing the data in inbox files. @code{movemail} can work -with POP if you compile it with the macro @code{MAIL_USE_POP} defined. -(You can achieve that by specifying @samp{--with-pop} when you run -@code{configure} during the installation of Emacs.) -@code{movemail} only works with POP3, not with older +instead of storing the data in inbox files. @code{Emacs +movemail} can work with POP if you compile it with the macro +@code{MAIL_USE_POP} defined.(You can achieve that by specifying +@samp{--with-pop} when you run @code{configure} during the +installation of Emacs.) + +@code{Mailutils movemail} by default supports POP, unless configured +with @samp{--disable-pop} option. + +Both versions of @code{movemail} only work with POP3, not with older versions of POP. = @cindex @env{MAILHOST} environment variable -@cindex POP inboxes - Assuming you have compiled and installed @code{movemail} -appropriately, you can specify a POP inbox by using a ``file name'' of -the form @samp{po:@var{username}}, in the inbox list of an Rmail file. -@code{movemail} handles such a name by opening a connection to the POP -server. The @env{MAILHOST} environment variable specifies the machine -to look for the server on; alternatively, you can specify the POP server -host name as part of the mailbox name using the syntax -@samp{po:@var{username}:@var{hostname}}. +@cindex POP mailboxes + No matter which flavor of @code{movemail} you use, you can specify +POP inbox by using POP @dfn{URL} (@pxref{Movemail}). A POP +@acronym{URL} is a ``file name'' of the form +@samp{pop://@var{username}@@@var{hostname}}, where +@var{hostname} is the host name or IP address of the remote mail +server and @var{username} is the user name on that +server. Additionally, you may specify the password in the mailbox @acronym{= URL}: +@samp{pop://@var{username}:@var{password}@@@var{hostname}}. In this +case @var{password} takes preference over the one set by +@code{rmail-remote-password}. This is especially useful if you have +several remote mailboxes with different passwords. = + + For backward compatibility Rmail also supports two alternative ways +of specifying remote POP mailboxes. Specifying inbox name in the form +@samp{po:@var{username}:@var{hostname}} is equivalent to = +@samp{pop://@var{username}@@@var{hostname}}. Alternatively, you may set +a ``file name'' of @samp{po:@var{username}} in the inbox list of an +Rmail file. @code{Movemail} will handle such a name by opening a +connection to the POP server. The @env{MAILHOST} environment variable +will in this case specify the machine to look for the server on. + +@cindex IMAP inboxes + Another method for accessing remote mailboxes is IMAP. This method is +supported only by @code{mailutils movemail}. To specify an IMAP +mailbox in the inbox list, use the following mailbox @acronym{URL}: +@samp{imap://@var{username}[:@var{password}]@@@var{hostname}}. The +@var{password} part is optional, as descrbed above. = +@vindex rmail-remote-password +@vindex rmail-remote-password-required @vindex rmail-pop-password @vindex rmail-pop-password-required - Accessing mail via POP may require a password. If the variable -@code{rmail-pop-password} is non-@code{nil}, it specifies the password -to use for POP. Alternatively, if @code{rmail-pop-password-required} is -non-@code{nil}, then Rmail asks you for the password to use. + Accessing remote mail may require a password. Rmail uses the +following algorithm to retrieve it: + +@enumerate +@item If the @var{password} is present in mailbox URL (see above), it +is used. +@item If the variable @code{rmail-remote-password} is +non-@code{nil}, its value is used. +@item Otherwise, if @code{rmail-remote-password-required} is +non-@code{nil}, then Rmail will ask you for the password to use. +@item Otherwise Rmail assumes no password is required. +@end enumerate + + For compatibility with previous versions, @code{rmail-pop-password} +and @code{rmail-pop-password-required} may be used instead of +@code{rmail-remote-password} and @code{rmail-remote-password-required}. = @vindex rmail-movemail-flags If you need to pass additional command-line flags to @code{movemail}, @@ -1231,6 +1378,25 @@ received, you can tell @code{movemail} t downloaded messages by adding the @samp{-r} flag to @code{rmail-movemail-flags}. = +@cindex TLS encryption + @code{Mailutils movemail} supports TLS encryption. If you wish to +use it add @samp{--tls} flag to @code{rmail-movemail-flags}. + +@node Other Mailbox Formats +@section Retrieving Mail from Local Mailboxes in Various Formats + + If your incoming mail is stored on a local machine in a format other +than UNIX mailbox, you will need @code{mailutils movemail} to retrieve +it. @ref{Movemail}, for the detailed description of @code{movemail} +versions. + + For example, to retrieve mail from a @code{maildir} inbox located in +@file{/var/spool/mail/in}, you would set the following in Rmail inbox list:= + +@smallexample +maildir://var/spool/mail/in +@end smallexample + @ignore arch-tag: 034965f6-38df-47a2-a9f1-b8bc8ab37e23 @end ignore --1804289383-1101131704=:27437 Content-ID: <20041122155504.27437.2@Mirddin.farlep.net> Content-Type: text/plain --1804289383-1101131704=:27437 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --1804289383-1101131704=:27437--