help-emacs-windows
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [h-e-w] Emacs + Imap/MS Exchange


From: Underwood, Jonathan
Subject: Re: [h-e-w] Emacs + Imap/MS Exchange
Date: Wed, 28 Aug 2002 14:45:32 -0400

Hi 

First off, thanks to all who replied to my original question giving details
about how to setup and use gnus with imap support to send and receive mail
using emacs and a MS Exchange server (Galen Boyer, jasonr, andreas ames,
Allen Windhorn).

Following someone elses suggestion (I forget who and can't seem to find the
message in the archive) I also looked at the possibility of using cygwins
mail (www.cygwin.com) tools to do the job, and thought I'd outline how i got
that to work here for future reference as a quick start to anyone in the
future faced with an MS exchange server.

1) Getting mail using cygwin fetchmail and procmail with vm.
fetchmail needs to be setup prior to use. I did that by first running
fetchmailconf (program that is installed with fetchmail), and then tweaking
the resulting file ($HOME/.fetchmailrc) such that it looks like this:

set postmaster "Administrator"
set bouncemail
set no spambounce
set properties ""
# the -f - option below is needed for use with vm under emacs
poll mail.server.address with proto IMAP
       user 'underwoodj' there with password 'mypassword' is 'underwoodj'
here
       keep
       mda "/usr/bin/procmail -f -"

procmail is used as the local delivery mail transfer agent, and can be setup
to do all manner of complicated mail filtering which i didn't have the
inclination to explore. Anyway, most importantly, the "-f -" option produces
a mail spool file compatible with vm. mail will then be located in the
/var/spool/mail/Administrator file under the cygwin installation tree.

vm needs to be downloaded and installed (see www.wonderworkes.com/vm/), and
the following added to .emacs:

(setq load-path (append (list "c:/emacs/site-lisp/vm-7.07/") load-path))
(autoload 'vm "vm" "Start VM on your primary inbox." t)
(autoload 'vm-other-frame "vm" "Like `vm' but starts in another frame." t)
(autoload 'vm-visit-folder "vm" "Start VM on an arbitrary folder." t)
(autoload 'vm-visit-virtual-folder "vm" "Visit a VM virtual folder." t)
(autoload 'vm-mode "vm" "Run VM major mode on a buffer" t)
(autoload 'vm-mail "vm" "Send a mail message using VM." t)
(autoload 'vm-submit-bug-report "vm" "Send a bug report about VM." t)

and a vm initiatialization file setup ($HOME/.vm) containing something like
the following

(setq vm-spool-files '("c://cygwin//var//spool//mail//Administrator"))

along with any other vm setup stuff you fancy. See the vm documentation on
more complicated and functional ways of setting up spool file mail reading
etc.

Once that is all done mail can be checked for by typing "fetchmail" at a
cygwin command prompt, or by typing something like "fetchmail -d <time in
seconds>" to start fetchmail in daemon mode checking for mail every <time in
seconds>. Alternatively one could put together a simple lisp function to run
fetchmail  and then vm-get-new.mail.


2) Sending mail using ssmtp with user authentication.
In principle, the package smtpmail.el could be used for sending mail off to
your smtp server. The version bundled with emacs 21.2 however doesn't allow
for smtp authentication (however, see (3) below), and so i looked at using
ssmtp which is bundled with the cygwin mail tools.      
ssmtp needs to be setup - there is a program installed with ssmtp called
ssmtp-config which can do this for you and creates the file
/etc/ssmtp/ssmtp.conf which looks like:

#
# /etc/ssmtp.conf -- a config file for sSMTP sendmail.
#
# The person who gets all mail for userids < 10
root=postmaster
# The place where the mail goes. The actual machine name is required
# no MX records are consulted. Commonly mailhosts are named mail.domain.com
# The example will fit if you are in domain.com and you mailhub is so named.
mailhub=nrcmrdbh1.imsb.nrc.ca
# Where will the mail seem to come from?
#rewriteDomain=nrc.ca
# The full hostname
hostname=underwood.sims.nrc.ca
# Set this to never rewrite the "From:" line (unless not given) and to
# use that address in the "from line" of the envelope.
#FromLineOverride=YES

Note that for me, the mail hub has a different address to the exchange
server (this point had me stuck for hours)

Adding the following to the .emacs file sets the sendmail.el package to use
ssmtp:
(setq user-full-name "Jonathan Underwood")
(setq user-mail-address "address@hidden")
(setq sendmail-program '("c:/cygwin/usr/sbin/ssmtp.exe -auUSERNAME
-apPASSWORD"))

3) Sending mail using the latest version of smtpmail.el
The latest version of smtpmail.el (available from
http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/mail/smtpmail.el?re
v=HEAD&content-type=text/vnd.viewcvs-markup) allows for user authentication
on a smtp server. To use this instead of ssmtp, download that file, and
place it somewhere in your load path and add the following to .emacs

(setq smtpmail-smtp-server "nrcmrdbh1.imsb.nrc.ca")
(setq smtpmail-local-domain "nrc.ca")
(setq send-mail-function 'smtpmail-send-it) ; if you use `mail'
(setq smtpmail-auth-credentials  ; or use ~/.authinfo
      '(("nrcmrdbh1.imsb.nrc.ca" 25 "USERNAME" "PASSWORD")))
(load-library "smtpmail.el")



Hope this is of some use to someone. Apologies for such a long message.

jonathan.













reply via email to

[Prev in Thread] Current Thread [Next in Thread]