[ Combined Document ] | Contents | Previous | Next
You do not need to do much to use mail with Emacs under Windows, but you do need to be able to communicate with local mail daemons and mail servers (they do most of the work) to both receive and send mail from your system. These daemons and servers are typically running on the machines in your local network that are already handling mail for you and/or other users on other systems.
For outgoing mail, you need to use smtpmail.el, which enables Emacs to talk SMTP with mail daemons (smtpmail.el was originally written by Tomoji Kagatani <firstname.lastname@example.org> and is now included in the Emacs distribution). You also need to add the following to your startup file (be sure to customize for you and your system):
(setq user-full-name "Your full name") (setq user-mail-address "Your email address") (setq smtpmail-default-smtp-server "Domain name of machine with SMTP server") (setq smtpmail-local-domain nil) (setq send-mail-function 'smtpmail-send-it) (load-library "smtpmail")
Note that if you want to change the name of the smtp server after you've loaded smtpmail.el, you'll want to change the variable smtpmail-smtp-server.
If you are using GNUS to send mail, then you will also need:
(load-library "message") (setq message-send-mail-function 'smtpmail-send-it)
If you are experiencing problems with sending large messages, check the value of the variable smtpmail-debug-info. If it is non-nil, you should set it to nil:
(setq smtpmail-debug-info nil)
If you would like to queue your outgoing mail so that you can then later send it all as a batch (e.g., when you are working disconnected on a laptop), you can use the feedmail package written by Bill Carpenter <email@example.com>.
Feedmail comes with Emacs 20.
Fabio Somenzi <Fabio@Colorado.EDU> also sent the following as an example of setting up Feemail:
(setq send-mail-function 'feedmail-send-it) (autoload 'feedmail-send-it "feedmail") (autoload 'feedmail-run-the-queue "feedmail") (setq feedmail-buffer-eating-function 'feedmail-buffer-to-smtpmail) (setq feedmail-enable-queue t) ; optional (setq feedmail-queue-chatty nil) ; optional
Fabio also redefined the function make-auto-save-file-name to auto-save files in one local directory ($HOME/.save) and to strip out invalid characters in file names . Note that all files will auto-save to this directory; this allows Emacs to auto-save even when the folder files are on an inaccessible remote machine. Place the following definition of make-auto-save-file-name in your startup file to override the definition in winnt.el.
Lastly, if you would like to protect the primary folder from crashes while it is being written back to disk, then also place the following in your startup file (assuming you use VM):
(add-hook 'vm-mode-hook '(lambda () (make-local-variable 'file-precious-flag) (setq file-precious-flag t)))
For incoming mail using the RMAIL package and a POP3 mail server, you need only place the following in your startup file (again, be sure to customize):
(setenv "MAILHOST" "Domain name of machine with POP3 server") (setq rmail-primary-inbox-list '("po:Your login") rmail-pop-password-required t)
Note that you will need to customize the Domain name of machine with POP3 server and Your login fields to be the name of your POP server and your login name.
For incoming mail using the VM package and a POP3 mail server, you first need the vm package (check any elisp archive) and then you need to place the following in your .vm configuration file:
(setq vm-spool-files (list (list "~/INBOX" "POP3 server:110:pass:POP user name:*" "~/INBOX.CRASH")))
Note that you will need to customize the POP3 server and POP user name fields to be your login name and the name of your POP server. You will also probably want to customize the name of your inbox and crash files (~/INBOX and ~/INBOX.CRASH in the example above.)
You should be able to use Gnus 5.2 and above as a mail reader. The following was sent as an example by Marc Fleischeuers <Marc.Fleischeuers@kub.nl>:
(load-library "message") ;; For sending mail (setq message-send-mail-function 'smtpmail-send-it) ;; For reading mail (other backends can be substituted for nnml) (setq gnus-secondary-select-methods '((nnml ""))) (setq nnmail-spool-file "po:POP user name") (setq nnmail-pop-password-required t)
Be sure to customize the POP user name field appropriately.
Setting up Gnus for reading IMAP email.
There are a number of different mail packages available within emacs. Unfortunately, only two of them (Gnus and Vm) currently support IMAP. Of those, only Gnus supports IMAP as intended (leaving the messages on the server so that they can be accessed from multiple clients). Since our decision is made for us, here's how to set up Gnus for reading IMAP mail at LLNL.
(setq load-path (cons (expand-file-name "~/emacs/elisp/gnus-5.8.7/lisp/") load-path))
;; ;; Gnus for IMAP ;; ; setup nnimap to read the correct mailspool (setq gnus-select-method '(nnimap "mail-imap" (nnimap-address "YOUR.IMAP.SERVER.HERE"))) (setq nnimap-list-pattern "INBOX") ; I don't read usenet, so don't bother setting up a server for it ; If you do read usenet, just move the stuff above to here. (setq gnus-secondary-select-methods nil) (setq gnus-check-new-newsgroups nil) ; configure nnfolder to save sent messages and drafts ; in this case it uses folders named ``sent.YEAR'' which ; are created and rotated automatically (setq nnfolder-active-file (expand-file-name "~/News/archive/active")) (setq nnnfolder-directory (expand-file-name "~/News/archive/")) (setq gnus-message-archive-method '(nnfolder "archive" (nnfolder-inhibit-expiry t))) (setq gnus-message-archive-group (concat "sent." (format-time-string "%Y"))) (setq nndraft-directory (expand-file-name "~/News/drafts"))
If you want to share your rmail folders between Unix and Windows NT/95, you'll want to handle all your mail in binary format. This includes mail stored in folders as well as incoming mail. For mail stored in folders, you'll want to treat the directory in which you store your mail as an untranslated file system; see the section on translation below on how to do this.
For incoming mail using RMAIL, you'll need to make a small patch to rmail.el. See Don Erway's <firstname.lastname@example.org> message describing the patch and what else he did to setup sharing between Unix and Windows NT/95.
Mail packages often provide some way to notify you when email has arrived (a la "biff" in Unix), conveniently distracting you from getting any real work done. There are myriad ways to do this, and as people tell me them I will try to mention them here.
Franklin Lee <email@example.com> has extended the pop3 package so that you can have your mail left on the server instead of always being downloaded (it also has a biff-mode with international "barks", which can be used whether or not you download or leave your mail on the server). You'll need to download a zip archive containing a patched pop3.el and some additional elisp files:
If you unpack on Unix, be sure to use "unzip -a" to strip any carriage returns.
For instructions on how to install and configure this package so that you can leave your mail on your pop3 servers, see the instructions at the top of the epop3mail.el file.
This should potentially work with other mail packages that rely upon the pop3 elisp code. If you find that it does, or implement the glue necessary to make it work, let me know and I'll update this FAQ entry.
vm doesn't use pop3 (it has its own code) and leaving email on the server runs 'out of the box'. use:
(setq vm-pop-expunge-after-retrieving nil)
There's also a vm-pop-auto-expunge-alist variable.
19.34 Metamail is a package that allows you to receive and send MIME attachments using Emacs. For details, see the README file:
* win32 symbols are now w32. (That is all symbols, and functions that used to have a "win32" prefix now begin with "w32". * new support for coding systems should be taken advantage of and old references to binary vs. text for files and processes should be upgraded to the v20 approach. * deal with the references to mule and junet which are now wildly out of date.
I don't know of any complete ports of tm to the Windows environment, but Fabrice Popineau <firstname.lastname@example.org> has made some modifications to the OS2 version of tm. See his description of what he has done for more info. The support programs mentioned can be found in mm.zip (note that they have only been tested on NT 4.0, though).
Gian Uberto Lauri <email@example.com> has written a win-biff tool for use with pop mail servers. [More Info]
To read news with Emacs, you can use the Gnus package. To invoke Gnus, type "M-x gnus" and Emacs will prompt you for a news server to connect to. For more information about using Gnus, take a look at:
If you need to connect and post to an authenticated news server, you'll need to give Gnus a password to send along to the server. To have Gnus prompt for a password, add the following to your startup file:
(add-hook 'nntp-server-opened-hook 'nntp-send-authinfo)
For more discussion and other methods of giving Gnus a password, see a discussion on the topic.
See the "Does Gnus have MIME support?" question from the Gnus FAQ.
To save messages untranslated (no carriage returns), you must set the default-buffer-file-type to binary:
(setq default-buffer-file-type t)
David Finucane <firstname.lastname@example.org> has written an elisp/Java package that makes it easy to read online newspapers through Emacs:
Download the latest version from the W3 homepage, ftp://ftp.xemacs.org/pub/xemacs/emacs-w3/ and follow the directions in the README.NT file.
You may find helpful information at the w3 homepage : http://www.cs.indiana.edu/elisp/w3/docs.html.
20.4 and later You should be able to use the browse-url package that comes with the Emacs distribution. It uses a new function to replace the external shellex helper program (see `w32-shell-execute' for details.
Peter Breton <email@example.com> wrote a small package for using browse-url to do dictionary lookups, internet word searches, etc. The package is called simple-web.
David Finucane <firstname.lastname@example.org> has written an elisp/Java package that uses the AltaVista translation service to translate text among a number of languages.
Emacs 20.3 comes with an ange-ftp.el that can use the standard Windows ftp.exe, so you should not need to download anything to use ange-ftp.
If you are behind a firewall you may have problems, because the native FTP client doesn't support passive mode, if this is the case then you'll need to download ftp-for-win32.zip, and follow the instructions below.
Place the ftp.exe executable in a directory where you keep your local executables. Then be sure that the exec-path variable is set so that, when Emacs runs the ftp.exe program, it runs the one you downloaded (and not the default one). As an example, assuming that you placed ftp.exe in, say, %HOME%\bin, you could set exec-path as follows in your startup file:
(setq exec-path (cons (expand-file-name "~/bin") exec-path))
As another alternative, you can tell ange-ftp exactly which ftp program to use by customizing ange-ftp-ftp-program-name, e.g.:
(setq ange-ftp-ftp-program-name "c:/bin/ftp.exe")
With this method you don't have to worry about the wrong ftp program being picked up through exec-path.
You will also want to customize the temporary directory that ange-ftp uses to cache files:
(setq ange-ftp-tmp-name-template (concat (expand-file-name (getenv "TEMP")) "/ange-ftp")) (setq ange-ftp-gateway-tmp-name-template (concat (expand-file-name (getenv "TEMP")) "/ange-ftp"))
Before you can use telnet-mode from within Emacs, you need a telnet client other than the one found on the system; the system telnet is a windows app, and cannot be used as a subprocess since it does not use stdio for input and output.
Two possible telnet clients that you can use are:
Unfortunately, this telnet program requires that the host be specified on the command line, but telnet-mode wants to specify the host using the "open" command once telnet has started. Zoltan Kemenczy <email@example.com> has written a version of the telnet-mode function that does this. To use it, place "(require 'telnet)" in your startup file, followed by Zoltan's new telnet-mode code.
If the new telnet-mode still does not work for you, then you will probably find it easiest to run telnet inside of a shell buffer (instead of using telnet-mode). If you use the Borland C compiler and want to do a little hacking, it would be great if you could change this telnet to be able to start up without requiring a host on the command line. The source is included in the above zip file, and Naftali has some tips for making this change.
The jtelnet page describes how to set it up for use with Emacs. For the other telnet client, you can either place the telnet.exe program in your exec-path (e.g., anywhere in your PATH, or in the Emacs bin directory) or set the telnet-program variable in your startup file to point to the executable.
[ Combined Document ]
| Contents |
Steve Kemp, FAQ Maintainer