[ Combined Document ] | Contents | Previous | Next


How do I use mail with Emacs?

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.

Outgoing

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 <kagatani@rbc.ncl.omron.co.jp> 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)

Outgoing: Queued

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 <bill@bubblegum.net>.

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)))

Incoming: RMAIL and POP3

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.

Incoming: VM and POP3

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.)

Incoming: GNUS

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.

Using GNUS with IMAP

 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"))

Sharing with Unix: RMAIL

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 <derway@ndc.com> message describing the patch and what else he did to setup sharing between Unix and Windows NT/95.

Mail notification

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.

Leaving on server: RMAIL

Franklin Lee <lee.franklin@worldnet.att.net> 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 in 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.

Leaving on server: VM

 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.

Handling attachments: Metamail

19.34 Metamail is a package that allows you to receive and send MIME attachments using Emacs. For details, see the README file:

Note that this version only works with Emacs 19.34. John Dennis, who originally ported metamail, does not have the time to maintain the current version or upgrade it to Emacs 20. If you have the time and interest to do the upgrade, I encourage you to try. Many users would appreciate your efforts. John lists the following tasks that need to be done to do the upgrade:
* 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.

Handling attachments: MIME with tm

I don't know of any complete ports of tm to the Windows environment, but Fabrice Popineau <popineau@esemetz.ese-metz.fr> 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, through).

Biff tools: POP

Gian Uberto Lauri <lauri@eng.it> has written a win-biff tool for use with pop mail servers. [More Info]

How do I read news with Emacs using Gnus?

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:

How do I open attatchments with Gnus?

 In your HOME directory create a file called ".mailcap", place the following in it:

application/* start "" %s

 After restarting Emacs, then you can open the default viewer for all attatchments by hitting return on the attatchment. Note this will RUN any .exe attatchments - which may not be, quite, what you want.

How do I authenticate with Gnus?

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.

How do I use mime with Gnus?

See the "Does Gnus have MIME support?" question from the Gnus FAQ.

How do I save messages in untranslated format?

To save messages untranslated (no carriage returns), you must set the default-buffer-file-type to binary:

(setq default-buffer-file-type t)

How do I read online newspapers with Emacs?

Some of the package that makes it easy to read online newspapers through Emacs:

Recent versions of GNUS can also handle reading some web sites as news, Slashdot.org for example.

How do I use the w3 package?

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.

How do I use the browse-url package?

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.

Package for using browse-url for dictionary, search, etc. functions

Peter Breton <pbreton@i-kinetics.com> wrote a small package for using browse-url to do dictionary lookups, internet word searches, etc. The package is called simple-web.

How do I use Emacs to translate text among languages?

Some packages that can be used for translating text among a number of languages.

How do I use FTP, (ange-ftp), within Emacs?

20.3

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.exe, 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"))

How do I use telnet with Emacs?

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:


[ Combined Document ] | Contents | Previous | Next

$Author: ramprasadb $ <ramprasad@gnu.org>


Updated: $Date: 2006/10/01 11:40:14 $