Next: , Previous: Sub-processes, Up: Top


8 Network access

8.1 How do I use mail in Emacs?

Emacs comes with several options for reading and writing mail. These are documented in the manual, and the choice of which method to use depends on personal taste. There are some issues specific to Windows however, related to the fact that Windows machines do not have the mail infrastructure that is commonly installed on other platforms, so mail will not work without some configuration.

8.1.1 Outgoing mail

For outgoing mail, you will need to use smtpmail.el which allows Emacs to talk directly to SMTP mail servers. This is included with Emacs, and can be set up as follows:

     (setq user-full-name "Your full name")
     (setq user-mail-address "Your@email.address")
     (setq smtpmail-default-smtp-server "domain.name.of.your.smtp.server")
     
     (setq send-mail-command 'smtpmail-send-it) ; For mail-mode (Rmail)
     (setq message-send-mail-function 'smtpmail-send-it) ; For message-mode (Gnus)

Note that if you want to change the name of the SMTP server after smtpmail is loaded, then you'll need to change smtpmail-smtp-server.

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:

8.1.2 Incoming mail with Rmail and POP3

For incoming mail using the Rmail package and a POP3 server, you will need the following configuration:

     (setenv "MAILHOST" "domain.name.of.your.pop3.server")
     (setq rmail-primary-inbox-list '("po:your logon id"))
     (setq rmail-pop-password-required t)

8.1.3 Incoming mail with Gnus

Although Gnus started life as a Usenet news reader, it also makes a good mail reader, particularly if you subscribe to a lot of mailing lists, or you want to use IMAP rather than POP3, which is not supported by Rmail. Because of the varied ways of setting up Gnus, it is best that you read the Gnus manual, and seek help on news:gnu.emacs.gnus if needed.

8.1.4 Other incoming mail options

Other options for reading mail in Emacs include VM, MH-E and Wanderlust. All of these require lisp or executable code that does not come with Emacs, so you should seek help where you obtained the packages from if you want to use them.

8.2 How do I open attachments in Gnus?

In your HOME directory create a file called .mailcap, with contents like the following:

     application/zip "C:/Program Files/7-Zip/7zFM.exe"
     video/* "C:/Program Files/VideoLAN/VLC/vlc.exe"

Warning: Associating MIME types with start or other generic Windows commands to open arbitrary files might seem like a good idea, but it leaves your system as open to attack as Outlook Express was at its worst. Especially dangerous is associating application/* or */* in this way.

8.3 How do I use FTP within Emacs?

Windows built in FTP client can be used with ange-ftp. Ange-ftp is the Emacs package that provides FTP connectivity to tramp, a multi-protocol remote file access package for Emacs that is enabled by default.

The Windows FTP client does have problems with some firewalls, due to lack of passive mode support, so you may want to try an alternative ftp client instead. Make sure that the client you are trying is in your PATH before the default Windows client, or rename the default Windows client to avoid it getting in the way. Alternatively you can customize ange-ftp-ftp-program-name to the full path to the version you are trying. See Other useful ports.

8.4 How do I use Tramp to work in Emacs via SSH?

Tramp can use a number of protocols to connect to remote machines to read files and even run commands on those files remotely. A popular one is ssh. As well as Cygwin versions of openssh, you can use PuTTY's command line plink program as the ssh client. The relevant methods to use in tramp-default-method or tramp-default-method-alist for these options are:

8.5 How do I use telnet with Emacs?

To use telnet-mode on Windows, you need a telnet client that uses stdin and stdout for input and output. The default Windows client is a Windows application, and will not work as a subprocess. Several options exist, but information that was formerly in this FAQ is out of date now, so no concrete pointers are available.