📜 ⬆️ ⬇️

We work with mail through Emacs and Wanderlust: several accounts

The time has come for the second article about Wanderlust, an e-mail client working under Emacs. Today we will try to configure it to work with mail from several different mailboxes, access to which is made both via IMAP and POP3 protocol. The basics of working with Wanderlust are described here .



First of all, a small introduction to the logic of Wanderlust - there are no mailboxes as configuration units in the client, but there are folders. In the simplest case, a folder can be an analog of a mailbox, as for example in Thunderbird. Usually within one mailbox we have several main folders - Inbox, Drafts, Spam, Sent. In Wanderlust they can be grouped into one category - and we will get the same mailbox we are used to in Thunderbird.
')
In order to customize the list of mailboxes, Wanderlust uses the .folders file, staying in holy confidence that no other program will use a file with the same name for its needs. This file is stored in your home directory. Here is an example of the contents of the .folders file for three accounts - IMAP and POP3:

#  ,     gmail.com some_test@gmail.com { %INBOX:some_test/clear@imap.gmail.com:993! "" %[Gmail]/:some_test/clear@imap.gmail.com:993! "" %[Gmail]/:some_test/clear@imap.gmail.com:993! "" %[Gmail]/:some_test/clear@imap.gmail.com:993! "" #   : # % -      IMAP # INBOX  [Gmail]/ -    IMAP  # : -  # some_test -     # / -  # clear -  ,  IMAP     # @ -  # imap.gmail.com:993 -    # ! -         SSL,  !!,  TLS # "" -       Wanderlust } #        -    IMAP . #        ,     #       rambler_test@rambler.ru { %INBOX:rambler_test/clear@imap.rambler.ru:993! "" %DraftBox:rambler_test/clear@imap.rambler.ru:993! "" %SentBox:rambler_test/clear@imap.rambler.ru:993! "" %Spam:rambler_test/clear@imap.rambler.ru:993! "" %Trash:rambler_test/clear@imap.rambler.ru:993! "" } #   POP3  #    POP3       #            #       ""  - mail_ru_test@mail.ru { &mail_ru_test/user@pop.mail.ru:995! "" # & -      POP3 # mail_ru_test -   # / -  # user -    POP3 # @ -  # pop.mail.ru:995 -    # ! -  SSL } 


Gmail uses Russian IMAP folder names, which Wanderlust does not support by default, so to receive mail from them you will have to add the following to your .emacs file:

 (setq elmo-imap4-use-modified-utf7 t) 


By the way, the debian wl-beta package contains a bug due to which the loading of mail from the POP3 folder hangs Wanderlust tightly. So, you may have to install a more recent version using el-get. A good article describing how to set it up is here .

Now you can launch a new instance of Emacs, press Mx wl and enter passwords for your mailboxes. So that you do not need to enter passwords every time you start Wanderlust, after you enter them all, click Ax elmo-passwd-alist-save.

Now you can read the mail, but for now just read — you cannot even write a letter or even delete them, and therefore let's try to set up this much-desired functionality. Here is what you need to add to the .emacs file to get a full-fledged email client:

 ;;      -        ;;     .     , ;;    ,     .     ;;  %INBOX:some_test/clear@imap.gmail.com:993!     ;; "^%.*some_test",          ;; [Gmail]/:some_test/clear@imap.gmail.com:993! (setq wl-dispose-folder-alist '( ("^%.*some_test" . "%[Gmail]/:some_test/clear@imap.gmail.com:993!") ("^%.*rambler_test" . "%Trash:rambler_test/clear@imap.rambler.ru:993!") )) ;;   ,       (setq wl-user-mail-address-list (quote ("some_test@gmail.com" "rambler_test@rambler.ru" "mail_ru_test@mail.ru"))) ;;       - ,  smtp       (setq wl-insert-message-id nil) ;;         ;;          (add-hook 'wl-mail-setup-hook 'wl-draft-config-exec) (remove-hook 'wl-draft-send-hook 'wl-draft-config-exec) ;;    SMTP          (setq wl-draft-config-matchone t) ;;              (setq wl-draft-config-alist '( ;; some_test@gmail.com ( (string-match "some_test" wl-draft-parent-folder) (wl-message-id-domain . "some_test@gmail.com") (wl-from . "some_test ") ("From" . "some_test@gmail.com") (wl-smtp-posting-server . "smtp.gmail.com") (wl-smtp-connection-type . 'starttls) (wl-smtp-posting-port . 587) (wl-smtp-authenticate-type . "plain") (wl-smtp-posting-user . "some_test") (wl-local-domain . "smtp.gmail.com") ) ;; rambler_test@rambler.ru ( (string-match "rambler_test" wl-draft-parent-folder) (wl-message-id-domain . "rambler_test@rambler.ru") (wl-from . "rambler_test ") ("From" . "rambler_test@rambler.ru") (wl-smtp-posting-server . "smtp.rambler.ru") (wl-smtp-connection-type . 'starttls) (wl-smtp-posting-port . 587) (wl-smtp-authenticate-type . "plain") (wl-smtp-posting-user . "rambler_test") (wl-local-domain . "smtp.rambler.ru") ) ;; mail_ru@mail.ru ( (string-match "mail_ru" wl-draft-parent-folder) (wl-message-id-domain . "mail_ru@mail.ru") (wl-from . "mail_ru ") ("From" . "mail_ru@mail.ru") (wl-smtp-posting-server . "smtp.mail.ru") (wl-smtp-connection-type . 'starttls) (wl-smtp-posting-port . 587) (wl-smtp-authenticate-type . "plain") (wl-smtp-posting-user . "mail_ru") (wl-local-domain . "smtp.mail.ru") ))) 


Just in case, check the server names and authentication methods. You can usually find out the information in the web interface to your email service. Moreover, in order not to pollute the .emacs file, it supports reading settings at startup from the .wl file — it should be located in your home directory as well as .folders. And finally - we will slightly correct the appearance to get something similar to the screenshot at the beginning of the article:
 (setq ;;      Thunderbird -   , ;;        wl-stay-folder-window t wl-folder-window-width 40 ;;           wl-message-ignored-field-list '("^.*:") wl-message-visible-field-list '("^\\(To\\|Cc\\):" "^Subject:" "^\\(From\\|Reply-To\\):" "^Organization:" "^Message-Id:" "^\\(Posted\\|Date\\):" ) wl-message-sort-field-list '("^From" "^Organization:" "^X-Attribution:" "^Subject" "^Date" "^To" "^Cc")) 

Source: https://habr.com/ru/post/192460/


All Articles