Strange behaviour on context picking

26 views
Skip to first unread message

Fanpeng Kong

unread,
Jan 13, 2017, 4:55:43 AM1/13/17
to mu-discuss
Hi there,

I set up two email accounts, Gmail and my university email, in my `mu4e-contexts'. However, I encountered some strange behaviour on the context picking. Suppose I am in the Gmail context now, and have weekly emails displayed. When I try to archive those emails, they are all marked with moving to the Gmail archive folder. Also, when I try to reply an email from my Uni account, somehow mu4e picks the Gmail as the sending account. BUT, if I change my context to my Uni account, and repeat the above operations again, mu4e picks the right context correctly, i.e. archive to the right folder and reply with the right account. Any suggestions on this issue? 

Below is the related configuration for my mu4e (shortcuts also work fine within different context):

;; Context policy
(setq mu4e-context-policy 'pick-first)
(setq mu4e-compose-context-policy nil)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Contexts for multiple accounts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(setq mu4e-contexts
      `( ,(make-mu4e-context
  :name "Gmail"
  :enter-func (lambda () (mu4e-message "Switch to the Gmail context"))
  ;; leave-func not defined
  :match-func (lambda (msg)
(when msg
  (mu4e-message-contact-field-matches msg
      :to "guess...@gmail.com")))
  :vars '((mu4e-sent-folder       . "/gmail/[Gmail].Sent Mail")   ;; folder for sent messages
  (mu4e-drafts-folder     . "/gmail/[Gmail].Drafts")      ;; unfinished messages
  (mu4e-trash-folder      . "/gmail/[Gmail].Trash")       ;; trashed messages
  (mu4e-refile-folder     . "/gmail/[Gmail].All Mail")   ;; saved messages
  (user-mail-address   . "guess...@gmail.com")
  (user-full-name   . "Guess Gmail" )
  
  ;; Shortcuts
  (mu4e-maildir-shortcuts . (("/gmail/INBOX"               . ?i)
     ("/gmail/[Gmail].Sent Mail"   . ?s)
     ("/gmail/[Gmail].Drafts"      . ?d)
     ("/gmail/[Gmail].Trash"       . ?t)
     ("/gmail/[Gmail].All Mail"    . ?a)))

  ;; don't save message to Sent Messages, Gmail/IMAP takes care of this
  (mu4e-sent-messages-behavior . delete)

  ;; SMTP configuration
  (starttls-use-gnutls           . t)
  (smtpmail-starttls-credentials . '(("smtp.gmail.com" 587 nil nil)))
  (smtpmail-auth-credentials     . (expand-file-name "~/.authinfo.gpg"))
  (smtpmail-default-smtp-server  . "smtp.gmail.com")
  (smtpmail-smtp-server          . "smtp.gmail.com")
  (smtpmail-smtp-service         . 587)
  (smtpmail-debug-info           . t)
  ))

,(make-mu4e-context
  :name "Uni"
  :enter-func (lambda () (mu4e-message "Switch to the Uni context"))
  ;; leave-fun not defined
  :match-func (lambda (msg)
(when msg
  (mu4e-message-contact-field-matches msg
      :to "gues...@uni.edu.au")))
  :vars '((mu4e-sent-folder       . "/uni/Sent Items")
  (mu4e-drafts-folder     . "/uni/Drafts")
  (mu4e-trash-folder      . "/uni/Deleted Items")
  (mu4e-refile-folder     . "/uni/Archive")
  (user-mail-address   . "gues...@uni.edu.au")
  (user-full-name   . "Guess Uni")

  ;; Shortcuts
  (mu4e-maildir-shortcuts . (("/uni/INBOX"         . ?i)
     ("/uni/Sent Items"    . ?s)
     ("/uni/Drafts"        . ?d)
     ("/uni/Deleted Items" . ?t)
     ("/uni/Archive"       . ?a)))

  (mu4e-sent-messages-behavior . sent)

  ;; SMTP configuration
  (starttls-use-gnutls           . t)
  (smtpmail-starttls-credentials . '(("smtp.office365.com" 587 nil nil)))
  (smtpmail-auth-credentials     . (expand-file-name "~/.authinfo.gpg"))
  (smtpmail-default-smtp-server  . "smtp.office365.com")
  (smtpmail-smtp-server          . "smtp.office365.com")
  (smtpmail-smtp-service         . 587)
  (smtpmail-debug-info           . t)
  ))
))
 
Reply all
Reply to author
Forward
0 new messages