mu4e and gmail

927 views
Skip to first unread message

Fabio Tonti

unread,
Jan 20, 2013, 8:08:52 AM1/20/13
to mu-di...@googlegroups.com
Hello everyone,
I'd like to use mu4e for my Gmail account. After a few trials I have now setup offlineimap in a way to only sync "All Mail", "Drafts", "Trash" and "Spam" in order to not have duplicated messages (I will refrain from using any Labels in my gmail account).
But how do I setup mu4e in order to not create any confusion or inconsistencies? Specifically, what do I set "mu4e-sent-folder" to?

Thanks in advance.

Best,
Fabio Tonti

Nathan Yergler

unread,
Jan 20, 2013, 1:53:39 PM1/20/13
to mu-di...@googlegroups.com
If you're sending outbound mail through Gmail's SMTP server, it will
auto-magically put a copy of the message in Sent Mail (which feeds into
All Mail, I believe) for you. On my setup I have the following settings:

(setq mu4e-sent-folder "/[Gmail].Sent Mail")
(setq mu4e-trash-folder "/[Gmail].Trash")
(setq mu4e-refile-folder "/[Gmail].All Mail")

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

With this configuration, I don't think the mu4e-sent-folder actually
matters much.

Hope that helps!

NRY

Dirk-Jan C. Binnema

unread,
Jan 20, 2013, 2:23:38 PM1/20/13
to mu-di...@googlegroups.com
Hi Fabio,
There are some examples in the mu4e manual; basically, you can set you
sent folder to the normal GMail sent folder, but you just don't let mu4e
save messages there (since GMail/offlineimap take care of that). See
`mu4e-sent-messages-behavior'.

Best wishes,
Dirk.


--
Dirk-Jan C. Binnema Helsinki, Finland
e:dj...@djcbsoftware.nl w:www.djcbsoftware.nl
pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C

Fabio Tonti

unread,
Jan 20, 2013, 2:36:25 PM1/20/13
to mu-di...@googlegroups.com
@Nathan: thanks, this is actually what I was hoping to hear - I just
feared that I could mess up my messages somehow by doing this.

@Dirk: I know, but synching "[Gmail]/Sent" is *exactly* what I want to
avoid - it is not a real folder and duplicates everything.

I'll see if I'm happy with it - what the manual and other people on
the net are suggesting doesn't really sound convincing - alternatively
one could sync everything *except* "All Mail", but that feels somehow
inconsistent to me with regard to how I use the web interface. So I
decided to simply drop my usage of Labels and "starred" things in
order to be able to use mu4e *and* the web interface when necessary.
Not sure if this makes sense to anyone who reads this (except me), but
I'm only trying to explain myself.

Best wishes,
Fabio

Dirk-Jan C. Binnema

unread,
Jan 20, 2013, 2:52:14 PM1/20/13
to mu-di...@googlegroups.com
Hi Fabio,

On Sun, Jan 20 2013, Fabio Tonti wrote:

mu/mu4e master/git at least allows you to hide duplicate messages, so
having duplicates might not be too much of a problem.

Anyway, if you don't care about labels and magical folders etc., you can
use Gmail and its pop3 interface instead of offlineimap; I'm using that,
and it works for me.

Fabio Tonti

unread,
Jan 20, 2013, 3:00:37 PM1/20/13
to mu-di...@googlegroups.com
On Sun, Jan 20, 2013 at 8:52 PM, Dirk-Jan C. Binnema
<dj...@djcbsoftware.nl> wrote:
> mu/mu4e master/git at least allows you to hide duplicate messages, so
> having duplicates might not be too much of a problem.
Good to know, yes.

> Anyway, if you don't care about labels and magical folders etc., you can
> use Gmail and its pop3 interface instead of offlineimap; I'm using that,
> and it works for me.
Could you elaborate on that, please?
Thank you again!

Fabio

Dirk-Jan C. Binnema

unread,
Jan 20, 2013, 3:19:53 PM1/20/13
to mu-di...@googlegroups.com

On Sun, Jan 20 2013, Fabio Tonti wrote:

There's not much to elaborate, really. Just enable pop3 access in the
gmail web interface, and use e.g. fetchmail to download your mail.

Fabio Tonti

unread,
Jan 20, 2013, 3:32:13 PM1/20/13
to mu-di...@googlegroups.com
> There's not much to elaborate, really. Just enable pop3 access in the
> gmail web interface, and use e.g. fetchmail to download your mail.
Ok, but how is this different than what I was saying (using IMAP and
"All Mail")? At least I can delete things and sync with the server?!
Or do you see any benefits in POP-usage?

Fabio

SF

unread,
Jan 20, 2013, 5:02:53 PM1/20/13
to mu-di...@googlegroups.com
This setup has worked well for me since I started using offlineimap and gmail a long time ago.

** Offlineimap

Sync these with offlineimap:
folderfilter = lambda foldername: foldername in [
             'INBOX',
             '[Gmail]/All Mail',
             '[Gmail]/Trash',
             '[Gmail]/Sent Mail',
             '[Gmail]/Trash',
# add any other labels you use
             ]

** mu settings

Put a .noindex in Sent Mail, Trash, and Drafts to avoid duplicates.

** mu4e settings

In mu4e add a default bcc header for yourself, so you have a copy. Note that gmail automatically removes duplicates in case you send email through their IMAP server. The BCC allows you to use a different SMTP server and you will still have everything in your gmail account.

(add-hook 'mu4e-compose-mode-hook
      (defun my-add-bcc ()
        "Add a Bcc: header."
        (save-excursion
          (message-add-header "Bcc: m...@example.com\n"))

(setq
 mu4e-maildir       "~/.mail"   ;; top-level Maildir

 mu4e-sent-folder   "/[Gmail].Sent Mail"
 mu4e-drafts-folder "/[Gmail].Drafts"     ;; unfinished messages
 mu4e-trash-folder  "/[Gmail].Trash")      ;; trashed messages

Don't save sent messages. Gmail takes care of that.

(setq mu4e-sent-messages-behavior 'delete)


** Gmail settings

Put a rule in gmail, so your BCC email doesn't show up as new:
From: m...@example.com do: skip inbox, mark as read

** Done.

You inbox will behave like any other inbox. New mail and other stuff you haven't deleted in there, will be in there. Just delete mails in your inbox, because they will be in All Mail anyways. If you want to really delete a message you need to move it to the trash with (mu4e-headers-mark-for-trash) and sync with offlineimap. Gmail will then automatically delete messages in the Trash folder beyond a certain age.

The only downside is that, when you trash messages, you need to sync them to gmail. But that's acceptable as long as you have a reasonable uplink and do it in the background.

Fabio Tonti

unread,
Jan 20, 2013, 5:02:57 PM1/20/13
to mu-di...@googlegroups.com
Oh, and I misread something:
@Nathan and @Dirk: can anything bad happen if I set
(setq mu4e-sent-folder "/[Gmail].All Mail")
?

Dirk-Jan C. Binnema

unread,
Jan 21, 2013, 2:25:03 AM1/21/13
to mu-di...@googlegroups.com
Hi Fabio,

On Sun, Jan 20 2013, Fabio Tonti wrote:

Well, all solutions have their pros and cons, I'm just adding another
one to the mix. Personally, I don't care much about deleting things on
the server side, or whether the online folders/labels correspond to what
I use locally. And I always try to keep my inbox empty, so a folder with
mixes both new / archived mail (like "All Mail"), is not really what I
want; POP3 roughly does what I want.

Nathan Yergler

unread,
Jan 22, 2013, 12:36:21 AM1/22/13
to mu-di...@googlegroups.com
I don't think so, but I've never tried it. If you're also telling mu4e
not to store a copy of sent emails, you could probably just point it
to a dummy folder that isn't synced by offlineimap.

NRY
Reply all
Reply to author
Forward
0 new messages