gnus-alias provides a simple mechanism to switch Identities when using message-mode.  An Identity is one or more of the following elements:

* From - sets the From header (i.e. the sender)
* Organization - sets the Organization header (a common, optional header)
* Extra headers - a list of arbitrary header to set (e.g. X-Archive: no)
* Body - adds text to the body of the message (just above the signature)
* Signature - adds a signature to the message

All of this is also provided by the standard `gnus-posting-styles'.  Whereas PostingStyles let you set these up initially, though, gnus-alias lets you change them on the fly easily, too (in this regard gnus-alias is much like GnusPers, upon which it is based).  With a simple command (`gnus-alias-select-identity') you can select & replace one Identity with another.

To activate Gnus-Alias identity rules such as selecting one needs to call <code>(gnus-alias-init)</code> or add <b><i>gnus-alias-determine-identity</i></b> to <b><i>message-setup-hook</i></b>. manually

There are other significant differences between gnus-alias and PostingStyles, too.  gnus-alias has a much simpler interface/API for selecting an initial Identity automatically.  PostingStyles is much more flexible (especially in that you can build up an "Identity" piece by piece), but with that flexibility can come some complexity.

Other advantages to using gnus-alias:

* the ability to switch Identities in a message buffer
* can access original message to help determine Identity of the followup/reply message
* can act on a forwarded message as if it were a message being replied to
* can start a new message with a given Identity pre-selected (coming soon)


Latest version by original author can be found at: http://www.northbound-train.com/emacs.html

Emacswiki hosts a slightly updated version: Lisp:gnus-alias.el

-- The Emacswiki version does not seem to work in XEmacs 21.4.

And this version adds a few goodies, including support swapping identities in multi-part MIME messages: https://github.com/altruizine/gnus-alias

-- I wanted to use gnus-alias to add an Fcc header in some identities as follows:

<pre>
(setq gnus-alias-identity-alist
      '(("work"
         nil
         "My Name <my.name@emailaddress.com>"
         nil ;; No organization header
         (("Fcc" . "/home/myname/Mail/Gmail/Archive")
          ("X-Message-SMTP-Method" . "smtp smtp.gmail.com 587")) ;; extra headers to save outgoing mail
         nil ;; No extra body text
         nil ;; No signature))
</pre>

The above example also shows how to associate an appropriate SMTP server with an alias. Read more about the mail extra
header in SendingMail.

However, the version of gnus-alias from emacswiki tests to see whether "/home/myname/Mail/Gmail/Archive" is a file and tries to insert its contents, which yields an error since it is a file AND a directory. I think gnus-alias should test whether "/home/myname/Mail/Gmail/Archive" is a file BUT NOT a directory, so I've amended the relevant part of the function gnus-alias-get-value as follows: at around line 1170 change from this:

     ;; .........................
     ;; FILE
     ((and (> (length element) 0)
           (file-exists-p element))


to this:

     ;; .........................
     ;; FILE
     ((and (> (length element) 0)
           (and (file-exists-p element)
                (not (file-directory-p element))))

Now the extra fcc header works as I think it should. - Geoff Ferrari

----

CategoryGnus CategoryMail
