16

There is a lot written for using emacs as a full-blown primary email program. I am looking for something with a simple setup so that I can keep Thunderbird as my primary email management program but compose and send email in emacs. Since python can send mail from the command line, I suspect this would not be too difficult for emacs.

Next step: if possible I'd still like to be able to sync with an imap server to pull off the last ~100 emails so I can compose responses in emacs. This wouldn't require folder management, but some amount of syncing, though I don't need to keep the messages locally available to emacs after the session. Would it still require offlineimap?

Any suggestions for a suitable configuration?

8
  • 1
    Have a look at the EmacsWiki: Category Mail. It offers a number of options, some of which you might find useful.
    – Dan
    Commented Nov 17, 2014 at 1:24
  • 1
    Yes, there are way too many options to configure and test out. I would appreciate input from experienced users who might have an idea on which alternatives might best suit these needs.
    – hatmatrix
    Commented Nov 17, 2014 at 1:57
  • 2
    mu4e seems appropriate for you.
    – shackra
    Commented Nov 17, 2014 at 3:20
  • 1
    There is nothing simple about Emacs. Be prepared to spend a lot of time customizing it to your liking and learning some or a lot of elisp along the way. However, it is very rewarding once you get it to do exactly what you want it to do. I use Wanderlust, and am still tweaking it's behavior from time to time -- it's been a year already and tweaking / customizing Emacs has been a daily obsession of mine.
    – lawlist
    Commented Nov 17, 2014 at 4:30
  • I suspect this question is currently too broad and needs to be made more discrete, but would prefer that the community decides the point.
    – Dan
    Commented Nov 17, 2014 at 15:30

4 Answers 4

10

You can use the External Editor add-on to Thunderbird, and then set your external editor to emacs. If you go to this site, you can download the file exteditor_v100.xpi. Then from inside of Thunderbird, from the add-ons manager, you can "install add-on from file". After you restart, you can find the options for External Editor in the add-ons manager, and from there you can put the path to your emacs as your external editor. That should suit your needs.

With all of that being said:

I am looking for something with a simple setup so that I can keep Thunderbird as my primary email management program but compose and send email in emacs.

This is a problem, and I'm not sure you actually want this. Any simple setup that edits mail inside of emacs won't use Thunderbird as your primary email management.

I highly recommend using mu4e and offlineimap. I started using it before I knew anything about emacs, and it was about as straightforward as an email client can be.

5
  • This is potentially a better answer than you're implying. Any chance you could edit it to include information about how to set up the External Editor in Thunderbird and, more importantly, what you'd need to do for setup on the Emacs side?
    – Dan
    Commented Nov 17, 2014 at 12:53
  • Unfortunately I'm not in a place where I can play around with it and test it at the moment. (I also don't have it set up myself.) This is the extension site but I'm afraid to say much more without using it myself. It seems that config might also be OS dependent. Commented Nov 17, 2014 at 13:06
  • Yeah that external editor extension is dead I think - last udpate 2008? Not available in list of extensions. I used to use it until it was no longer supported by Thunderbird.
    – hatmatrix
    Commented Nov 21, 2014 at 1:26
  • @crippledlambda It seems to still work (I just tried it), so it might be the best option for what you're going for. Commented Nov 21, 2014 at 5:28
  • @Seth, thanks - it did work(!?) but doesn't transfer the contents from emacs buffer to message as described. Currently having to copy-paste back to Thunderbird message window so doesn't resolve the situation, but I'm hoping the fix is something simple. Nonetheless, it's the closest to what I wanted to for this question so I'll mark it as answered.
    – hatmatrix
    Commented Nov 26, 2014 at 10:56
5

This should at least, get you started:

but compose and send email in emacs. Since python can send mail from the command line, I suspect this would not be too difficult for emacs.

This is what I have in my init file for composing mail, and send them using gmail, gnutsl should be installed in your OS:

;; send mail
(setq
 send-mail-function 'smtpmail-send-it
 message-send-mail-function 'smtpmail-send-it
 user-mail-address "[email protected]"
 smtpmail-starttls-credentials '(("smtp.gmail.com" "587" nil nil))
 smtpmail-auth-credentials  (expand-file-name "~/.authinfo")
 smtpmail-default-smtp-server "smtp.gmail.com"
 smtpmail-smtp-server "smtp.gmail.com"
 smtpmail-smtp-service 587
 smtpmail-debug-info t
 starttls-extra-arguments nil
 starttls-gnutls-program "/usr/bin/gnutls-cli"
 starttls-extra-arguments nil
 starttls-use-gnutls t
)

Next step: if possible I'd still like to be able to sync with an imap server to pull off the last ~100 emails so I can compose responses in emacs. This wouldn't require folder management, but some amount of syncing, though I don't need to keep the messages locally available to emacs after the session

You should configure your mailbox and enable IMAP, you'll be able to manage your mails from many devices. This is my config, for reading mails from gmail using emacs & gnus:

;read mail w/ gnus
(setq gnus-select-method '(nnimap "gmail"
(nnimap-address "imap.gmail.com")
(nnimap-server-port 993)
(nnimap-stream ssl)))
(setq mm-discouraged-alternatives '("text/html" "text/richtext"))

Would it still require offlineimap?

I've never used offlineimap, but you should if you want to manage your mails when offline, then, as soon as you're online, the sync will occur between your computer and the server

The ~/.authinfo file will be used to store your credentials, and it will have at least two lines, the first line for sending mails:

machine smtp.gmail.com port 587 login [email protected] password NotsoiNcreDiblePassword

The second one for retrieving mails:

machine imap.gmail.com secret port 993 login [email protected] password NotsoiNcreDiblePassword

2

Next step: if possible I'd still like to be able to sync with an imap server to pull off the last ~100 emails so I can compose responses in emacs. This wouldn't require folder management, but some amount of syncing, though I don't need to keep the messages locally available to emacs after the session. Would it still require offlineimap?

If you want synchronization with an IMAP server I recommend working with a local maildir and offlineimap to sync it with a remote server. Dependent on your folder structure you could limit synchronisation to a single directory and purge it once you're done. (Offlineimap won't delete emails that you deleted locally if you also delete the cache.)

If your maildir is already managed by Thunderbird, however, you really don't need offineimap at all as you can simply open existing emails as files (that's the beauty of maildir compared to some more dense format).

To write emails you really only need to create text files with the right headers. message-mode does this for you. (Most email clients for Emacs simply reuse message-mode instead of inventing their own interface for composing emails.) Once you have a valid email file you can use a separate command (such as msmtp) to send it. You can configure message-mode to use msmtp like this:

(setq mail-specify-envelope-from t)
(setq mail-envelope-from 'header)
(setq message-sendmail-envelope-from 'header)
(setq message-send-mail-function 'message-send-mail-with-sendmail)

;;use msmtp instead of sendmail
(setq sendmail-program "/usr/bin/msmtp")

Your msmtp configuration is independent from Emacs and you can use it outside of Emacs.

Now you're only a small step from also reading your email in Emacs. For this task I recommend using mu4e. Of course, this is completely optional as you can read your sync'd maildir with any other mail client. Thunderbird, for example, can use a local maildir as the storage backend.

1

For those who seek a replacement of the original External Editor to work with newer Thunderbirds: https://github.com/Frederick888/external-editor-revived.

Make sure you check out the wiki for setup instructions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.