Filipp Gunbin
2014-10-02 14:48:48 UTC
Here's my solution to the problem. I'm not sure I'm doing it right.
Perhaps somebody could suggest me a better option.
I have two accounts - one private and one for work.
1) Get mail from both
(setq gnus-select-method '(nnnil "")) ; turn off primary select method
(setq gnus-secondary-select-methods '((nnml ""))) ; only mail here
(setq mail-sources '((imap :server "mail.messagingengine.com"
:user "***@fastmail.fm"
:stream ssl
:mailbox "Inbox")
(imap :server "outlook.office365.com"
:user "***@playteam.ru"
:stream ssl)))
In combination with nnmail-split-methods this downloads and spreads new
emails over several nnml groups.
2) Default address and smtp server
(setq smtpmail-smtp-server "mail.messagingengine.com"
smtpmail-smtp-service 587
user-mail-address "***@fastmail.fm")
3) Answering to emails
(setq gnus-posting-styles
'((".*"
(address "***@fastmail.fm")
("X-Message-SMTP-Method" "smtp mail.messagingengine.com 587"))
("nnml:mail.okko"
(address "***@okko.tv")
("X-Message-SMTP-Method" "smtp outlook.office365.com 587"))))
This sets appropriate address and SMTP server for a group I'm replying
from. All work emails are splitted into a single group: nnml:mail.okko,
so we are overriding only for that group.
Before I had also this setting, but it seems to be useless with the
posting styles configuration above.
(setq message-alternative-emails "fgunbin@\\(fastmail.fm\\|okko.tv\\)")
4) Composing new email
This is awkward:
(defun select-mail-address (&optional to subject other-headers continue
switch-function yank-action
send-actions return-action)
"Advice that sets the mail address to use"
(let ((domain (completing-read "From: " '("okko.tv" "fastmail.fm")
nil t)))
(setq user-mail-address (concat "fgunbin@" domain))))
(advice-add 'compose-mail :before #'select-mail-address)
As written, it _sets_ the user-mail-address to be used from now on.
Other methods for starting message composition may not call compose-mail
and so this hook may not work there. SMTP server could also be set
here, but generally I don't care much which server I'm using.
Perhaps somebody could suggest me a better option.
I have two accounts - one private and one for work.
1) Get mail from both
(setq gnus-select-method '(nnnil "")) ; turn off primary select method
(setq gnus-secondary-select-methods '((nnml ""))) ; only mail here
(setq mail-sources '((imap :server "mail.messagingengine.com"
:user "***@fastmail.fm"
:stream ssl
:mailbox "Inbox")
(imap :server "outlook.office365.com"
:user "***@playteam.ru"
:stream ssl)))
In combination with nnmail-split-methods this downloads and spreads new
emails over several nnml groups.
2) Default address and smtp server
(setq smtpmail-smtp-server "mail.messagingengine.com"
smtpmail-smtp-service 587
user-mail-address "***@fastmail.fm")
3) Answering to emails
(setq gnus-posting-styles
'((".*"
(address "***@fastmail.fm")
("X-Message-SMTP-Method" "smtp mail.messagingengine.com 587"))
("nnml:mail.okko"
(address "***@okko.tv")
("X-Message-SMTP-Method" "smtp outlook.office365.com 587"))))
This sets appropriate address and SMTP server for a group I'm replying
from. All work emails are splitted into a single group: nnml:mail.okko,
so we are overriding only for that group.
Before I had also this setting, but it seems to be useless with the
posting styles configuration above.
(setq message-alternative-emails "fgunbin@\\(fastmail.fm\\|okko.tv\\)")
4) Composing new email
This is awkward:
(defun select-mail-address (&optional to subject other-headers continue
switch-function yank-action
send-actions return-action)
"Advice that sets the mail address to use"
(let ((domain (completing-read "From: " '("okko.tv" "fastmail.fm")
nil t)))
(setq user-mail-address (concat "fgunbin@" domain))))
(advice-add 'compose-mail :before #'select-mail-address)
As written, it _sets_ the user-mail-address to be used from now on.
Other methods for starting message composition may not call compose-mail
and so this hook may not work there. SMTP server could also be set
here, but generally I don't care much which server I'm using.
--
Filipp
Filipp