119 lines
2.2 KiB
Markdown
119 lines
2.2 KiB
Markdown
---
|
|
publish: true
|
|
permalink: /10-19 LIFE/13 TECH SETUP/13.11 APPS/isync.md
|
|
title: isync (mbsync)
|
|
created: 2026-01-30T08:09:43.461-07:00
|
|
modified: 2026-02-05T09:12:58.913-07:00
|
|
tags:
|
|
- email
|
|
- sync
|
|
- imap
|
|
cssclasses: ""
|
|
---
|
|
|
|
isync (command: `mbsync`) is a tool for synchronizing IMAP mailboxes with local Maildir folders. Essential for offline email access with clients like [[10-19 LIFE/13 TECH SETUP/13.11 APPS/aerc]] or mutt.
|
|
|
|
## Installation
|
|
|
|
**Arch Linux:**
|
|
```bash
|
|
sudo pacman -S isync
|
|
```
|
|
|
|
## ProtonMail Integration
|
|
|
|
ProtonMail requires the Proton Bridge app for IMAP access. See the [Arch Wiki guide](https://wiki.archlinux.org/title/Isync#Integration_with_ProtonMail) for details.
|
|
|
|
### Setup with Proton Bridge
|
|
|
|
1. Install and run Proton Bridge
|
|
2. Get credentials from Bridge (it generates local IMAP/SMTP credentials)
|
|
3. Configure mbsync as below
|
|
|
|
## Configuration
|
|
|
|
`~/.mbsyncrc`:
|
|
```ini
|
|
# Global settings
|
|
Create Both
|
|
Remove Both
|
|
Expunge Both
|
|
SyncState *
|
|
|
|
# ProtonMail via Proton Bridge
|
|
IMAPAccount proton
|
|
Host 127.0.0.1
|
|
Port 1143
|
|
User your-email@proton.me
|
|
PassCmd "cat ~/.config/proton-bridge/password"
|
|
SSLType STARTTLS
|
|
CertificateFile ~/.config/proton-bridge/cert.pem
|
|
|
|
IMAPStore proton-remote
|
|
Account proton
|
|
|
|
MaildirStore proton-local
|
|
Path ~/.local/share/mail/proton/
|
|
Inbox ~/.local/share/mail/proton/INBOX
|
|
SubFolders Verbatim
|
|
|
|
Channel proton
|
|
Far :proton-remote:
|
|
Near :proton-local:
|
|
Patterns *
|
|
```
|
|
|
|
## Usage
|
|
|
|
```bash
|
|
# Sync all configured channels
|
|
mbsync -a
|
|
|
|
# Sync specific channel
|
|
mbsync proton
|
|
|
|
# Verbose output
|
|
mbsync -V proton
|
|
|
|
# Dry run (show what would happen)
|
|
mbsync -n proton
|
|
```
|
|
|
|
## Automation
|
|
|
|
### systemd timer
|
|
`~/.config/systemd/user/mbsync.timer`:
|
|
```ini
|
|
[Unit]
|
|
Description=Sync mail periodically
|
|
|
|
[Timer]
|
|
OnBootSec=1m
|
|
OnUnitActiveSec=5m
|
|
|
|
[Install]
|
|
WantedBy=timers.target
|
|
```
|
|
|
|
`~/.config/systemd/user/mbsync.service`:
|
|
```ini
|
|
[Unit]
|
|
Description=Sync mail
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
ExecStart=/usr/bin/mbsync -a
|
|
```
|
|
|
|
Enable:
|
|
```bash
|
|
systemctl --user enable --now mbsync.timer
|
|
```
|
|
|
|
## Tips
|
|
|
|
- Create the local maildir first: `mkdir -p ~/.local/share/mail/proton`
|
|
- Use `PassCmd` to avoid storing passwords in config
|
|
- The `Patterns *` line syncs all folders; use specific patterns to limit
|
|
- Check sync status with `mbsync -V` for verbose output
|