[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: My first article with Gnus, eventually...
From: |
harven |
Subject: |
Re: My first article with Gnus, eventually... |
Date: |
Thu, 16 Oct 2008 13:41:25 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (darwin) |
Francis Moreau <francis.moro@gmail.com> writes:
>>> - Sometimes I send email directly from the shell prompt:
>>>
>>> echo "A short line" | mail <address>
>>>
>>> How can I do this with Gnus ?
>>
>> You don't need gnus to send a message from emacs. Just type C-x m.
>> Some customization is needed however if you want to add attachments,
>> or specify your user-name and server. Have a look at the following
>> page.
>> http://www.emacswiki.org/cgi-bin/wiki/MessageMode
>>
>
> Hmm, I don't think that answers the question. I wnat to send a message
> from a shell. Emacs is not started.
You can put the following in your .emacs
(defun my-mail ()
(interactive)
(let ((address (read-from-minibuffer "Address: "))
(subject (read-from-minibuffer "Subject: "))
(text (read-from-minibuffer "Text: " )))
(mail 'new address subject)
(insert text)
(mail-send-and-exit)))
Then call it from the command-line with emacs in batch mode
emacs -Q --no-site-file -batch -l ~/.emacs -f my-mail 2>/dev/null
You will be prompted for an address, a subject and a text for your mail.
emacs will then send it and quit. Note that gnus is not used here,
emacs will use the method specified in your .emacs to send the mail
(see e.g. http://www.emacswiki.org/cgi-bin/wiki/MessageMode).
Note also that this will read your .emacs, which may or may not be
what you want.
If you don't want to actually parse your .emacs, put in some file,
say ~/.my-mail, the previous function and the method you want to use
to send mail, e.g.
(setq user-full-name "me myself and I"
user-mail-address "me@somewhere.edu"
send-mail-function 'smtpmail-send-it
smtpmail-smtp-server "smtp.myisp.uk")
Don't forget to execute the my-mail function at the end of the file
(my-mail)
>From the command line, you can now use
emacs --no-site-file -batch -l ~/.my-mail
You can also put the following at the very start of the .my-mail file
#!/usr/bin/emacs --script
then just call it from the command line by typing .my-mail.
See http://www.emacswiki.org/cgi-bin/wiki/CategoryBatchMode for more detail
- Re: My first article with Gnus, eventually..., (continued)
Re: My first article with Gnus, eventually..., harven, 2008/10/15