Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: [EN] Email in Emacs (mbsync and mu4e)  (Read 2133 times)

Offline finotti

  • User
  • Posts: 269
[EN] Email in Emacs (mbsync and mu4e)
« on: 2022/03/03, 23:45:27 »
This not related to siduction itself (I believe).

Does anyone here has experience with mbsync and or reading Email with Emacs.  I'm trying to set it up and read quite a bit, but I am stumped as for why it is not working...

Here is my .mbsyncrc. with GMail accounts (emails redacted):

Code: [Select]
# Personal GMail
IMAPAccount gmail
Host imap.gmail.com
User XXXXXX@gmail.com
PassCmd "pass XXXX_pass"
SSLType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt

IMAPStore gmail-remote
Account gmail

MaildirStore gmail-local
Subfolders Verbatim
Path ~/Mail/GMail/
Inbox ~/Mail/GMail/Inbox

Channel gmail
Far :gmail-remote:
Near :gmail-local:
Patterns * ![Gmail]* "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail" "[Gmail]/Trash"
Create Both
SyncState *

#######################################

# Math GMail
IMAPAccount math
Host imap.gmail.com
User YYYYYY@gmail.com
PassCmd "pass YYYY_pass"
SSLType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt

IMAPStore math-remote
Account math

MaildirStore math-local
Subfolders Verbatim
Path ~/Mail/Math/
Inbox ~/Mail/Math/Inbox

Channel math
Far :math-remote:
Near :math-local:
Patterns * ![Gmail]* "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail" "[Gmail]/Trash"
Create Both
SyncState *

When I run "mbsync -a", it always takes a long time (hours) and the size of "~/Mail" is already a lot larger than what GMail reports for both accounts.  (9.4GB vs 6.1GB.)

Here is some of the current output:

Code: [Select]
$ mbsync -a
C: 1/2  B: 41/136  F: +0/0 *0/0 #0/0  N: +43/43 *15/15 #0/0
Warning: lost track of 10277 pulled message(s)
C: 1/2  B: 42/136  F: +0/0 *0/0 #0/0  N: +10319/10319 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 43/136  F: +0/0 *0/0 #0/0  N: +21428/21428 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 44/136  F: +0/0 *0/0 #0/0  N: +21823/21823 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 45/136  F: +0/0 *0/0 #0/0  N: +21959/21959 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 46/136  F: +0/0 *0/0 #0/0  N: +22568/22568 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 47/136  F: +0/0 *0/0 #0/0  N: +22758/22758 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 48/136  F: +0/0 *0/0 #0/0  N: +22784/22784 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 49/136  F: +0/0 *0/0 #0/0  N: +23043/23043 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 50/136  F: +0/0 *0/0 #0/0  N: +23058/23058 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 51/136  F: +0/0 *0/0 #0/0  N: +23059/23059 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 52/136  F: +0/0 *0/0 #0/0  N: +23066/23066 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 53/136  F: +0/0 *0/0 #0/0  N: +23067/23067 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 54/136  F: +0/0 *0/0 #0/0  N: +23096/23096 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 55/136  F: +0/0 *0/0 #0/0  N: +23108/23108 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 56/136  F: +0/0 *0/0 #0/0  N: +23133/23133 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 57/136  F: +0/0 *0/0 #0/0  N: +23262/23262 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 58/136  F: +0/0 *0/0 #0/0  N: +23299/23299 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 59/136  F: +0/0 *0/0 #0/0  N: +23445/23445 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 60/136  F: +0/0 *0/0 #0/0  N: +23769/23769 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 61/136  F: +0/0 *0/0 #0/0  N: +23860/23860 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 62/136  F: +0/0 *0/0 #0/0  N: +24365/24365 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 63/136  F: +0/0 *0/0 #0/0  N: +24386/24386 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 64/136  F: +0/0 *0/0 #0/0  N: +24862/24862 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 65/136  F: +0/0 *0/0 #0/0  N: +25075/25075 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 66/136  F: +0/0 *0/0 #0/0  N: +25518/25518 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 67/136  F: +0/0 *0/0 #0/0  N: +25529/25529 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 68/136  F: +0/0 *0/0 #0/0  N: +25547/25547 *15/15 #0/0
Maildir notice: no UIDVALIDITY, creating new.
C: 1/2  B: 69/136  F: +0/0 *0/0 #0/0  N: +25767/25767 *15/15 #0/0

If someone has experience with Emacs and is willing to help out, I can share my configuration for mu4e and problems as well, but even some help with mbsync only would be greatly appreciated.

Offline unklarer

  • User
  • Posts: 816
Re: Email in Emacs (mbsync and mu4e)
« Reply #1 on: 2022/03/04, 22:29:47 »
In *gugel* the access of a foreign software to the e-mail account is blocked. Therefore you have to allow this access in the 'settings' of the account on the web interface (called "allow unsafe software" or something like that).
Did you do that?   ;)

Offline finotti

  • User
  • Posts: 269
Re: Email in Emacs (mbsync and mu4e)
« Reply #2 on: 2022/03/04, 22:44:42 »
Thanks for the reply!

I have allowed IMPA for GMail.  After tweaking the folders/labels, it seems that I was able to download all the data.  The problem with the sizes is that, because of how GMail deals with labels (with the same message having multiple labels), the messages get duplicated in multiple folders.  In particular, "All Mail" has all messages, included those in different folders.

But right now I can use "mbsync -a", it does not give errors and it seems to finish in minutes (still too long!) rather than hours.  But I don't seem to be getting the new messages that arrive with it...

I ran it now:
Code: [Select]
$ mbsync -a
C: 2/2  B: 24/24  F: +0/0 *0/0 #0/0  N: +42/42 *72/72 #0/0

But, despite having new messages, I have no new messages showing up, as you can see from the time stamp:
Code: [Select]
$ ls -l
drwxr-xr-x - finotti  3 Mar 17:26 drafts/
drwxr-xr-x - finotti  3 Mar 18:52 GMail/
drwxr-xr-x - finotti  3 Mar 21:31 Math/
drwxr-xr-x - finotti  3 Mar 17:26 sent/
drwxr-xr-x - finotti  3 Mar 17:26 trash/

This is really frustrating...

Offline unklarer

  • User
  • Posts: 816
Re: Email in Emacs (mbsync and mu4e)
« Reply #3 on: 2022/03/05, 17:16:09 »
 :)  I'm not sure we're talking about the same thing.

Quote
Allow less secure apps: If you haven't set up two-step confirmation, you may need to allow less secure apps to access your account.

Quote
Access to your Google account by less secure apps.

To better protect your account, starting May 30, 2022, Google will no longer support third-party apps or devices where your username and password are sufficient to sign in to your Google Account. For more information, see this article.
Special note about signing in on Apple devices: Users who have not recently signed in to their Google account using only their username and password will only be able to make new attempts to sign in using the Google account type starting February 28, 2022. Existing users will be able to sign in to their Google account with their username and password until May 30, 2022.

If an app or website does not meet our security standards, Google will block any attempts to sign in to your account through it. Hackers can more easily access your account through less secure apps. Therefore, by blocking these login attempts, we protect your account.

Offline finotti

  • User
  • Posts: 269
Re: Email in Emacs (mbsync and mu4e)
« Reply #4 on: 2022/03/06, 14:52:30 »
Thanks again for the reply.

Yes, I have set up an "App Password" and I can authenticate and my initial download worked.  The problem now is that mbsync is not getting new messages.