Gnus Home
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

10.9.5 Composing messages

Question 5.1  What are the basic commands I need to know for sending mail and postings?
Question 5.2  How to enable automatic word-wrap when composing messages?
Question 5.3  How to set stuff like From, Organization, Reply-To, signature...?
Question 5.4  Can I set things like From, Signature etc group based on the group I post too?
Question 5.5  Is there a spell-checker? Perhaps even on-the-fly spell-checking?
Question 5.6  Can I set the dictionary based on the group I'm posting to?
Question 5.7  Is there some kind of address-book, so I needn't remember all those email addresses?
Question 5.8  Sometimes I see little images at the top of article buffer. What's that and how can I send one with my postings, too?
Question 5.9  Sometimes I accidentally hit r instead of f in newsgroups. Can Gnus warn me, when I'm replying by mail in newsgroups?
Question 5.10  How to tell Gnus not to generate a sender header?
Question 5.11  I want Gnus to locally store copies of my send mail and news, how to do it?
Question 5.12  I want Gnus to kill the buffer after successful sending instead of keeping it alive as "Sent mail to...", how to do it?
Question 5.13  People tell me my Message-IDs are not correct, why aren't they and how to fix it?

Question 5.1

What are the basic commands I need to know for sending mail and postings?

Answer

To start composing a new mail hit `m' either in Group or Summary buffer, for a posting, it's either `a' in Group buffer and filling the Newsgroups header manually or `a' in the Summary buffer of the group where the posting shall be send to. Replying by mail is `r' if you don't want to cite the author, or import the cited text manually and `R' to cite the text of the original message. For a follow up to a newsgroup, it's `f' and `F' (analogously to `r' and `R').

Enter new headers above the line saying "--text follows this line--", enter the text below the line. When ready hit `C-c C-c', to send the message, if you want to finish it later hit `C-c C-d' to save it in the drafts group, where you can start editing it again by saying `D e'.

Question 5.2

How to enable automatic word-wrap when composing messages?

Answer

Starting from No Gnus, automatic word-wrap is already enabled by default, see the variable message-fill-column.

For other versions of Gnus, say

 
(unless (boundp 'message-fill-column)
  (add-hook 'message-mode-hook
            (lambda ()
              (setq fill-column 72)
              (turn-on-auto-fill))))

in ~/.gnus.el.

You can reformat a paragraph by hitting `M-q' (as usual).

Question 5.3

How to set stuff like From, Organization, Reply-To, signature...?

Answer

There are other ways, but you should use posting styles for this. (See below why). This example should make the syntax clear:

 
(setq gnus-posting-styles
  '((".*"
     (name "Frank Schmitt")
     (address "me@there.invalid")
     (organization "Hamme net, kren mer och nimmi")
     (signature-file "~/.signature")
     ("X-SampleHeader" "foobar")
     (eval (setq some-variable "Foo bar")))))

The ".*" means that this settings are the default ones (see below), valid values for the first element of the following lists are signature, signature-file, organization, address, name or body. The attribute name can also be a string. In that case, this will be used as a header name, and the value will be inserted in the headers of the article; if the value is `nil', the header name will be removed. You can also say (eval (foo bar)), then the function foo will be evaluated with argument bar and the result will be thrown away.

Question 5.4

Can I set things like From, Signature etc group based on the group I post too?

Answer

That's the strength of posting styles. Before, we used ".*" to set the default for all groups. You can use a regexp like "^gmane" and the following settings are only applied to postings you send to the gmane hierarchy, use ".*binaries" instead and they will be applied to postings send to groups containing the string binaries in their name etc.

You can instead of specifying a regexp specify a function which is evaluated, only if it returns true, the corresponding settings take effect. Two interesting candidates for this are message-news-p which returns t if the current Group is a newsgroup and the corresponding message-mail-p.

Note that all forms that match are applied, that means in the example below, when I post to gmane.mail.spam.spamassassin.general, the settings under ".*" are applied and the settings under message-news-p and those under "^gmane" and those under "^gmane\\.mail\\.spam\\.spamassassin\\.general$". Because of this put general settings at the top and specific ones at the bottom.

 
(setq gnus-posting-styles
      '((".*" ;;default
         (name "Frank Schmitt")
         (organization "Hamme net, kren mer och nimmi")
         (signature-file "~/.signature"))
        ((message-news-p) ;;Usenet news?
         (address "mySpamTrap@Frank-Schmitt.invalid")
         (reply-to "hereRealRepliesOnlyPlease@Frank-Schmitt.invalid"))
        ((message-mail-p) ;;mail?
         (address "usedForMails@Frank-Schmitt.invalid"))
        ("^gmane" ;;this is mail, too in fact
         (address "usedForMails@Frank-Schmitt.invalid")
         (reply-to nil))
        ("^gmane\\.mail\\.spam\\.spamassassin\\.general$"
         (eval (set (make-local-variable 'message-sendmail-envelope-from)
                    "Azzrael@rz-online.de")))))

Question 5.5

Is there a spell-checker? Perhaps even on-the-fly spell-checking?

Answer

You can use ispell.el to spell-check stuff in Emacs. So the first thing to do is to make sure that you've got either ispell or aspell installed and in your Path. Then you need ispell.el and for on-the-fly spell-checking flyspell.el. Ispell.el is shipped with Emacs and available through the XEmacs package system, flyspell.el is shipped with Emacs and part of XEmacs text-modes package which is available through the package system, so there should be no need to install them manually.

Ispell.el assumes you use ispell, if you choose aspell say

 
(setq ispell-program-name "aspell")
in your Emacs configuration file.

If you want your outgoing messages to be spell-checked, say

 
(add-hook 'message-send-hook 'ispell-message)

In your ~/.gnus.el, if you prefer on-the-fly spell-checking say

 
(add-hook 'message-mode-hook (lambda () (flyspell-mode 1)))

Question 5.6

Can I set the dictionary based on the group I'm posting to?

Answer

Yes, say something like

 
(add-hook 'gnus-select-group-hook
          (lambda ()
            (cond
             ((string-match
               "^de\\." (gnus-group-real-name gnus-newsgroup-name))
              (ispell-change-dictionary "deutsch8"))
             (t
              (ispell-change-dictionary "english")))))
in ~/.gnus.el. Change "^de\\." and "deutsch8" to something that suits your needs.

Question 5.7

Is there some kind of address-book, so I needn't remember all those email addresses?

Answer

There's an very basic solution for this, mail aliases. You can store your mail addresses in a ~/.mailrc file using a simple alias syntax:

 
alias al	"Al <al@english-heritage.invalid>"

Then typing your alias (followed by a space or punctuation character) on a To: or Cc: line in the message buffer will cause Gnus to insert the full address for you. See the node "Mail Aliases" in Message (not Gnus) manual for details.

However, what you really want is the Insidious Big Brother Database bbdb. Get it through the XEmacs package system or from bbdb's homepage. Now place the following in ~/.gnus.el, to activate bbdb for Gnus:

 
(require 'bbdb)
(bbdb-initialize 'gnus 'message)

Now you probably want some general bbdb configuration, place them in ~/.emacs:

 
(require 'bbdb)
;;If you don't live in Northern America, you should disable the 
;;syntax check for telephone numbers by saying
(setq bbdb-north-american-phone-numbers-p nil)
;;Tell bbdb about your email address:
(setq bbdb-user-mail-names
      (regexp-opt '("Your.Email@here.invalid"
                    "Your.other@mail.there.invalid")))
;;cycling while completing email addresses
(setq bbdb-complete-name-allow-cycling t)
;;No popup-buffers
(setq bbdb-use-pop-up nil)

Now you should be ready to go. Say `M-x bbdb RET RET' to open a bbdb buffer showing all entries. Say `c' to create a new entry, `b' to search your BBDB and `C-o' to add a new field to an entry. If you want to add a sender to the BBDB you can also just hit `:' on the posting in the summary buffer and you are done. When you now compose a new mail, hit `TAB' to cycle through know recipients.

Question 5.8

Sometimes I see little images at the top of article buffer. What's that and how can I send one with my postings, too?

Answer

Those images are called X-Faces. They are 48*48 pixel b/w pictures, encoded in a header line. If you want to include one in your posts, you've got to convert some image to a X-Face. So fire up some image manipulation program (say Gimp), open the image you want to include, cut out the relevant part, reduce color depth to 1 bit, resize to 48*48 and save as bitmap. Now you should get the compface package from this site. and create the actual X-face by saying

 
cat file.xbm | xbm2ikon | compface > file.face
cat file.face | sed 's/\\/\\\\/g;s/\"/\\\"/g;' > file.face.quoted

If you can't use compface, there's an online X-face converter at http://www.dairiki.org/xface/. If you use MS Windows, you could also use the WinFace program from http://www.xs4all.nl/~walterln/winface/. Now you only have to tell Gnus to include the X-face in your postings by saying

 
(setq message-default-headers
        (with-temp-buffer
          (insert "X-Face: ")
          (insert-file-contents "~/.xface")
          (buffer-string)))

in ~/.gnus.el. If you use Gnus 5.10, you can simply add an entry

 
(x-face-file "~/.xface")

to gnus-posting-styles.

Question 5.9

Sometimes I accidentally hit r instead of f in newsgroups. Can Gnus warn me, when I'm replying by mail in newsgroups?

Answer

Put this in ~/.gnus.el:

 
(setq gnus-confirm-mail-reply-to-news t)

if you already use Gnus 5.10, if you still use 5.8.8 or 5.9 try this instead:

 
(eval-after-load "gnus-msg"
  '(unless (boundp 'gnus-confirm-mail-reply-to-news)
     (defadvice gnus-summary-reply (around reply-in-news activate)
       "Request confirmation when replying to news."
       (interactive)
       (when (or (not (gnus-news-group-p gnus-newsgroup-name))
                 (y-or-n-p "Really reply by mail to article author? "))
         ad-do-it))))

Question 5.10

How to tell Gnus not to generate a sender header?

Answer

Since 5.10 Gnus doesn't generate a sender header by default. For older Gnus' try this in ~/.gnus.el:

 
(eval-after-load "message"
      '(add-to-list 'message-syntax-checks '(sender . disabled)))

Question 5.11

I want Gnus to locally store copies of my send mail and news, how to do it?

Answer

You must set the variable gnus-message-archive-group to do this. You can set it to a string giving the name of the group where the copies shall go or like in the example below use a function which is evaluated and which returns the group to use.

 
(setq gnus-message-archive-group
	'((if (message-news-p)
	      "nnml:Send-News"
	    "nnml:Send-Mail")))

Question 5.12

I want Gnus to kill the buffer after successful sending instead of keeping it alive as "Sent mail to...", how to do it?

Answer

Add this to your ~/.gnus:

 
(setq message-kill-buffer-on-exit t)

Question 5.13

People tell me my Message-IDs are not correct, why aren't they and how to fix it?

Answer

The message-ID is an unique identifier for messages you send. To make it unique, Gnus need to know which machine name to put after the "@". If the name of the machine where Gnus is running isn't suitable (it probably isn't at most private machines) you can tell Gnus what to use by saying:

 
(setq message-user-fqdn "yourmachine.yourdomain.tld")

in ~/.gnus.el. If you use Gnus 5.9 or earlier, you can use this instead (works for newer versions as well):

 
(eval-after-load "message"
  '(let ((fqdn "yourmachine.yourdomain.tld"));; <-- Edit this!
     (if (boundp 'message-user-fqdn)
         (setq message-user-fqdn fqdn)
       (gnus-message 1 "Redefining `message-make-fqdn'.")
       (defun message-make-fqdn ()
         "Return user's fully qualified domain name."
         fqdn))))

If you have no idea what to insert for "yourmachine.yourdomain.tld", you've got several choices. You can either ask your provider if he allows you to use something like yourUserName.userfqdn.provider.net, or you can use somethingUnique.yourdomain.tld if you own the domain yourdomain.tld, or you can register at a service which gives private users a FQDN for free.

Finally you can tell Gnus not to generate a Message-ID for News at all (and letting the server do the job) by saying

 
(setq message-required-news-headers
  (remove' Message-ID message-required-news-headers))

you can also tell Gnus not to generate Message-IDs for mail by saying

 
(setq message-required-mail-headers
  (remove' Message-ID message-required-mail-headers))

, however some mail servers don't generate proper Message-IDs, too, so test if your Mail Server behaves correctly by sending yourself a Mail and looking at the Message-ID.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by on September, 5 2010 using texi2html